diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-04-02 11:15:17 -0400 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-04-02 11:15:17 -0400 |
commit | f73813a8bbb55ac725720f4d3839b51f992f1f3f (patch) | |
tree | 472c83f2ff6a7a1f1f93e3f2dedfe86cd1f24ae2 /Modules/threadmodule.c | |
parent | fe9417726c8d2a15ae11f553ae521c3ba6dfc6b7 (diff) | |
download | cpython-git-f73813a8bbb55ac725720f4d3839b51f992f1f3f.tar.gz |
prevent writing to stderr from messing up the exception state (closes #14474)
Diffstat (limited to 'Modules/threadmodule.c')
-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 4e41085ed9..73ee382df3 100644 --- a/Modules/threadmodule.c +++ b/Modules/threadmodule.c @@ -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); } |