summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-10-04 17:57:03 (GMT)
committerGitHub <noreply@github.com>2023-10-04 17:57:03 (GMT)
commitee317f7dddd71f2093f9e4b8431f84cbd636a8a2 (patch)
treee07e3b98f06db289efc6104bb35c6e778d4b03d9
parent3bbe3b7c822091caac90c00ee937848bc4de80eb (diff)
downloadcpython-ee317f7dddd71f2093f9e4b8431f84cbd636a8a2.zip
cpython-ee317f7dddd71f2093f9e4b8431f84cbd636a8a2.tar.gz
cpython-ee317f7dddd71f2093f9e4b8431f84cbd636a8a2.tar.bz2
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.)
-rw-r--r--Modules/_xxsubinterpretersmodule.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c
index 700282e..bca16ac 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);
}