Mercurial > cpython-lru_cache-weakref
diff Modules/threadmodule.c @ 76066:8609d7fcdcc7 2.7
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 | 7d3e0a0b0b8f |
| children | d552016fc07c |
line wrap: on
line diff
--- a/Modules/threadmodule.c Sun Apr 01 16:05:46 2012 +0200 +++ b/Modules/threadmodule.c Mon Apr 02 11:15:17 2012 -0400 @@ -618,6 +618,8 @@ 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 @@ PyFile_WriteObject(boot->func, file, 0); else PyObject_Print(boot->func, stderr, 0); + PyErr_Restore(exc, value, tb); PySys_WriteStderr("\n"); PyErr_PrintEx(0); }
