summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2014-02-09 00:43:21 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2014-02-09 00:43:21 (GMT)
commitd979e4335d02bee7301c2b2dec61fe2155fbae98 (patch)
tree03a43ccec3f7109d73c48f3782500be9c6579be5 /Python
parentc9d1a6b85eb9cb1ddd520cefc5f0c7a21a1b1e2c (diff)
downloadcpython-d979e4335d02bee7301c2b2dec61fe2155fbae98.zip
cpython-d979e4335d02bee7301c2b2dec61fe2155fbae98.tar.gz
cpython-d979e4335d02bee7301c2b2dec61fe2155fbae98.tar.bz2
Close #20500: Don't trigger PyObject_Str assertion at shutdown
Diffstat (limited to 'Python')
-rw-r--r--Python/pythonrun.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index ff9569b..34a291f 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -1792,6 +1792,11 @@ handle_system_exit(void)
exitcode = (int)PyLong_AsLong(value);
else {
PyObject *sys_stderr = _PySys_GetObjectId(&PyId_stderr);
+ /* We clear the exception here to avoid triggering the assertion
+ * in PyObject_Str that ensures it won't silently lose exception
+ * details.
+ */
+ PyErr_Clear();
if (sys_stderr != NULL && sys_stderr != Py_None) {
PyFile_WriteObject(value, sys_stderr, Py_PRINT_RAW);
} else {