diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-04-02 15:15:17 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-04-02 15:15:17 (GMT) |
commit | e900096dc42cd0d590752e00ba3983b4672da806 (patch) | |
tree | d8adc06a6312185ad155f4dea4e146e8447c42e8 /Modules | |
parent | b6af60c2a9e2625987bcdd6775eb9fe8834c9641 (diff) | |
download | cpython-e900096dc42cd0d590752e00ba3983b4672da806.zip cpython-e900096dc42cd0d590752e00ba3983b4672da806.tar.gz cpython-e900096dc42cd0d590752e00ba3983b4672da806.tar.bz2 |
prevent writing to stderr from messing up the exception state (closes #14474)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_threadmodule.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c index ea038de..5f76a7b 100644 --- a/Modules/_threadmodule.c +++ b/Modules/_threadmodule.c @@ -994,14 +994,17 @@ t_bootstrap(void *boot_raw) PyErr_Clear(); else { PyObject *file; + PyObject *exc, *value, *tb; PySys_WriteStderr( "Unhandled exception in thread started by "); + PyErr_Fetch(&exc, &value, &tb); file = PySys_GetObject("stderr"); if (file != NULL && file != Py_None) PyFile_WriteObject(boot->func, file, 0); else PyObject_Print(boot->func, stderr, 0); PySys_WriteStderr("\n"); + PyErr_Restore(exc, value, tb); PyErr_PrintEx(0); } } |