mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #7317: Display full tracebacks when an error occurs asynchronously.
Patch by Alon Horev with update by Alexey Kachayev.
This commit is contained in:
parent
6b973747f3
commit
76bcff27b2
4 changed files with 22 additions and 19 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue