Skip to content

Commit ee317f7

Browse files
gh-76785: Print the Traceback from Interpreter.run() (gh-110322)
This is a temporary solution. The full fix may involve serializing the traceback in some form. (FYI, I merged this yesterday and the reverted it due to buildbot failures. See gh-110248.)
1 parent 3bbe3b7 commit ee317f7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Modules/_xxsubinterpretersmodule.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,13 @@ _run_script(PyInterpreterState *interp, const char *codestr,
450450
"RunFailedError: script raised an uncaught exception (%s)",
451451
failure);
452452
}
453-
Py_XDECREF(excval);
453+
if (excval != NULL) {
454+
// XXX Instead, store the rendered traceback on sharedexc,
455+
// attach it to the exception when applied,
456+
// and teach PyErr_Display() to print it.
457+
PyErr_Display(NULL, excval, NULL);
458+
Py_DECREF(excval);
459+
}
454460
if (errcode != ERR_ALREADY_RUNNING) {
455461
_PyInterpreterState_SetNotRunningMain(interp);
456462
}

0 commit comments

Comments
 (0)