Mercurial > cpython-lru_cache-weakref
comparison Python/pythonrun.c @ 86333:c13ef65f3dcf
Issue #18776: atexit callbacks now display their full traceback when they raise an exception.
| author | Antoine Pitrou <solipsis@pitrou.net> |
|---|---|
| date | Sun, 13 Oct 2013 21:54:15 +0200 |
| parents | c7fdb0637d0b 19ce90930e8b |
| children | 9cd88b39ef62 |
comparison
equal
deleted
inserted
replaced
| 86331:2933598a7802 | 86333:c13ef65f3dcf |
|---|---|
| 1917 void | 1917 void |
| 1918 PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb) | 1918 PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb) |
| 1919 { | 1919 { |
| 1920 PyObject *seen; | 1920 PyObject *seen; |
| 1921 PyObject *f = PySys_GetObject("stderr"); | 1921 PyObject *f = PySys_GetObject("stderr"); |
| 1922 if (PyExceptionInstance_Check(value) | |
| 1923 && tb != NULL && PyTraceBack_Check(tb)) { | |
| 1924 /* Put the traceback on the exception, otherwise it won't get | |
| 1925 displayed. See issue #18776. */ | |
| 1926 PyObject *cur_tb = PyException_GetTraceback(value); | |
| 1927 if (cur_tb == NULL) | |
| 1928 PyException_SetTraceback(value, tb); | |
| 1929 else | |
| 1930 Py_DECREF(cur_tb); | |
| 1931 } | |
| 1922 if (f == Py_None) { | 1932 if (f == Py_None) { |
| 1923 /* pass */ | 1933 /* pass */ |
| 1924 } | 1934 } |
| 1925 else if (f == NULL) { | 1935 else if (f == NULL) { |
| 1926 _PyObject_Dump(value); | 1936 _PyObject_Dump(value); |
