diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-11-03 13:56:05 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-11-03 13:56:05 (GMT) |
commit | 76bcff27b2429d15805003ebeac8452698a61870 (patch) | |
tree | 2836230b92db267a387d45d7de23588770984261 /Python | |
parent | 6b973747f3c5e31afd89f6a7d79bc9f3f1628710 (diff) | |
download | cpython-76bcff27b2429d15805003ebeac8452698a61870.zip cpython-76bcff27b2429d15805003ebeac8452698a61870.tar.gz cpython-76bcff27b2429d15805003ebeac8452698a61870.tar.bz2 |
Issue #7317: Display full tracebacks when an error occurs asynchronously.
Patch by Alon Horev with update by Alexey Kachayev.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/errors.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Python/errors.c b/Python/errors.c index 626b16e..a2d1a82 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -798,7 +798,12 @@ PyErr_WriteUnraisable(PyObject *obj) PyErr_Fetch(&t, &v, &tb); f = PySys_GetObject("stderr"); if (f != NULL && f != Py_None) { - PyFile_WriteString("Exception ", f); + if (obj) { + PyFile_WriteString("Exception ignored in: ", f); + PyFile_WriteObject(obj, f, 0); + PyFile_WriteString("\n", f); + } + PyTraceBack_Print(tb, f); if (t) { PyObject* moduleName; char* className; @@ -828,15 +833,11 @@ PyErr_WriteUnraisable(PyObject *obj) PyFile_WriteString(className, f); if (v && v != Py_None) { PyFile_WriteString(": ", f); - PyFile_WriteObject(v, f, 0); + PyFile_WriteObject(v, f, Py_PRINT_RAW); } + PyFile_WriteString("\n", f); Py_XDECREF(moduleName); } - if (obj) { - PyFile_WriteString(" in ", f); - PyFile_WriteObject(obj, f, 0); - } - PyFile_WriteString(" ignored\n", f); PyErr_Clear(); /* Just in case */ } Py_XDECREF(t); |