From: Eric Snow Date: Wed, 4 Oct 2023 17:57:03 +0000 (-0600) Subject: gh-76785: Print the Traceback from Interpreter.run() (gh-110322) X-Git-Tag: v3.13.0a1~139 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ee317f7dddd71f2093f9e4b8431f84cbd636a8a2;p=thirdparty%2FPython%2Fcpython.git 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.) --- diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c index 700282efb8c6..bca16ac8a62e 100644 --- a/Modules/_xxsubinterpretersmodule.c +++ b/Modules/_xxsubinterpretersmodule.c @@ -450,7 +450,13 @@ error: "RunFailedError: script raised an uncaught exception (%s)", failure); } - Py_XDECREF(excval); + if (excval != NULL) { + // XXX Instead, store the rendered traceback on sharedexc, + // attach it to the exception when applied, + // and teach PyErr_Display() to print it. + PyErr_Display(NULL, excval, NULL); + Py_DECREF(excval); + } if (errcode != ERR_ALREADY_RUNNING) { _PyInterpreterState_SetNotRunningMain(interp); }