mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
Issue #22836: Keep exception reports sensible despite errors
This commit is contained in:
parent
738f88f688
commit
3263f6874a
5 changed files with 92 additions and 9 deletions
|
@ -900,8 +900,12 @@ PyErr_WriteUnraisable(PyObject *obj)
|
|||
if (obj) {
|
||||
if (PyFile_WriteString("Exception ignored in: ", f) < 0)
|
||||
goto done;
|
||||
if (PyFile_WriteObject(obj, f, 0) < 0)
|
||||
goto done;
|
||||
if (PyFile_WriteObject(obj, f, 0) < 0) {
|
||||
PyErr_Clear();
|
||||
if (PyFile_WriteString("<object repr() failed>", f) < 0) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
if (PyFile_WriteString("\n", f) < 0)
|
||||
goto done;
|
||||
}
|
||||
|
@ -946,8 +950,12 @@ PyErr_WriteUnraisable(PyObject *obj)
|
|||
if (v && v != Py_None) {
|
||||
if (PyFile_WriteString(": ", f) < 0)
|
||||
goto done;
|
||||
if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
|
||||
goto done;
|
||||
if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) {
|
||||
PyErr_Clear();
|
||||
if (PyFile_WriteString("<exception str() failed>", f) < 0) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (PyFile_WriteString("\n", f) < 0)
|
||||
goto done;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue