Skip to content

Commit 5621ab8

Browse files
committed
Do we have a unit test for the traceback code in error_string()?
1 parent ad146b2 commit 5621ab8

File tree

1 file changed

+0
-40
lines changed

1 file changed

+0
-40
lines changed

include/pybind11/detail/type_caster_base.h

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -493,46 +493,6 @@ PYBIND11_NOINLINE std::string error_string() {
493493
PyException_SetTraceback(scope.value, scope.trace);
494494
}
495495

496-
#if !defined(PYPY_VERSION)
497-
if (scope.trace) {
498-
auto *trace = (PyTracebackObject *) scope.trace;
499-
500-
/* Get the deepest trace possible */
501-
while (trace->tb_next) {
502-
trace = trace->tb_next;
503-
}
504-
505-
PyFrameObject *frame = trace->tb_frame;
506-
Py_XINCREF(frame);
507-
errorString += "\n\nAt:\n";
508-
while (frame) {
509-
# if PY_VERSION_HEX >= 0x030900B1
510-
PyCodeObject *f_code = PyFrame_GetCode(frame);
511-
# else
512-
PyCodeObject *f_code = frame->f_code;
513-
Py_INCREF(f_code);
514-
# endif
515-
int lineno = PyFrame_GetLineNumber(frame);
516-
errorString += " ";
517-
errorString += handle(f_code->co_filename).cast<std::string>();
518-
errorString += '(';
519-
errorString += std::to_string(lineno);
520-
errorString += "): ";
521-
errorString += handle(f_code->co_name).cast<std::string>();
522-
errorString += '\n';
523-
Py_DECREF(f_code);
524-
# if PY_VERSION_HEX >= 0x030900B1
525-
auto *b_frame = PyFrame_GetBack(frame);
526-
# else
527-
auto *b_frame = frame->f_back;
528-
Py_XINCREF(b_frame);
529-
# endif
530-
Py_DECREF(frame);
531-
frame = b_frame;
532-
}
533-
}
534-
#endif
535-
536496
return errorString;
537497
}
538498

0 commit comments

Comments
 (0)