summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2013-10-13 19:54:15 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2013-10-13 19:54:15 (GMT)
commit6039db8de30b5c20ba864cc4127fbfabf6fc0641 (patch)
tree6820fd9758156c17a71c07b906e9c45d5a0c9599 /Python
parentfbc3c3c2bed34350e0dde4771805c51b80f2e410 (diff)
parent24201d497cf23d399cceadad8058261c13ae536f (diff)
downloadcpython-6039db8de30b5c20ba864cc4127fbfabf6fc0641.zip
cpython-6039db8de30b5c20ba864cc4127fbfabf6fc0641.tar.gz
cpython-6039db8de30b5c20ba864cc4127fbfabf6fc0641.tar.bz2
Issue #18776: atexit callbacks now display their full traceback when they raise an exception.
Diffstat (limited to 'Python')
-rw-r--r--Python/pythonrun.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index c2ca563..06f30b0 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1919,6 +1919,16 @@ PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb)
{
PyObject *seen;
PyObject *f = PySys_GetObject("stderr");
+ if (PyExceptionInstance_Check(value)
+ && tb != NULL && PyTraceBack_Check(tb)) {
+ /* Put the traceback on the exception, otherwise it won't get
+ displayed. See issue #18776. */
+ PyObject *cur_tb = PyException_GetTraceback(value);
+ if (cur_tb == NULL)
+ PyException_SetTraceback(value, tb);
+ else
+ Py_DECREF(cur_tb);
+ }
if (f == Py_None) {
/* pass */
}