diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-10-13 21:53:13 +0200 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-10-13 21:53:13 +0200 |
commit | a5b3af7156594cc0a7964ac808f7807970912c8e (patch) | |
tree | b4f20939c49db34af4967eeeb63ce103b1a92b22 /Python/pythonrun.c | |
parent | 1414a3541e04314a3cc5af05b0b42d964d2450c0 (diff) | |
download | cpython-a5b3af7156594cc0a7964ac808f7807970912c8e.tar.gz |
Issue #18776: atexit callbacks now display their full traceback when they raise an exception.
Diffstat (limited to 'Python/pythonrun.c')
-rw-r--r-- | Python/pythonrun.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c index 9ef653b57a..ee277b67f2 100644 --- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -1880,6 +1880,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 */ } |