mirror of
https://github.com/python/cpython.git
synced 2025-09-15 21:26:04 +00:00
prevent writing to stderr from messing up the exception state (closes #14474)
This commit is contained in:
parent
fe9417726c
commit
f73813a8bb
3 changed files with 30 additions and 0 deletions
|
@ -618,6 +618,8 @@ t_bootstrap(void *boot_raw)
|
|||
PyErr_Clear();
|
||||
else {
|
||||
PyObject *file;
|
||||
PyObject *exc, *value, *tb;
|
||||
PyErr_Fetch(&exc, &value, &tb);
|
||||
PySys_WriteStderr(
|
||||
"Unhandled exception in thread started by ");
|
||||
file = PySys_GetObject("stderr");
|
||||
|
@ -625,6 +627,7 @@ t_bootstrap(void *boot_raw)
|
|||
PyFile_WriteObject(boot->func, file, 0);
|
||||
else
|
||||
PyObject_Print(boot->func, stderr, 0);
|
||||
PyErr_Restore(exc, value, tb);
|
||||
PySys_WriteStderr("\n");
|
||||
PyErr_PrintEx(0);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue