Mercurial > cpython-lru_cache-weakref
diff Modules/_threadmodule.c @ 76068:60ad83716733 3.2
prevent writing to stderr from messing up the exception state (closes #14474)
| author | Benjamin Peterson <benjamin@python.org> |
|---|---|
| date | Mon, 02 Apr 2012 11:15:17 -0400 |
| parents | Modules/threadmodule.c@86a2679dca46 |
| children | 0cc51c04aa20 b92e34c1e07c |
line wrap: on
line diff
--- a/Modules/_threadmodule.c Sun Apr 01 18:49:54 2012 -0400 +++ b/Modules/_threadmodule.c Mon Apr 02 11:15:17 2012 -0400 @@ -994,14 +994,17 @@ 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); } }
