mirror of
https://github.com/python/cpython.git
synced 2025-07-10 04:45:36 +00:00
Issue #18776: atexit callbacks now display their full traceback when they raise an exception.
This commit is contained in:
parent
4e985673bf
commit
24201d497c
3 changed files with 32 additions and 0 deletions
|
@ -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 */
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue