summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-16 01:54:37 +0200
committerVictor Stinner <victor.stinner@gmail.com>2013-07-16 01:54:37 +0200
commitabae51304280e0a8d15d65f8b440b20f3589de0e (patch)
tree05a16c26e8f198e63fcfc6a4577deed66618bdee /Python
parentf973f6bbe55ca322f5f32954cdb47fc9a418eb78 (diff)
downloadcpython-abae51304280e0a8d15d65f8b440b20f3589de0e.tar.gz
Issue #18408: Fix show_warning(), clear also the exception raised by
_Py_DisplaySourceLine() For example, _PyGC_DumpShutdownStats() calls PyErr_WarnExplicitFormat() while the import machinery does not work anymore, _Py_DisplaySourceLine() fails when trying to import the io module.
Diffstat (limited to 'Python')
-rw-r--r--Python/_warnings.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 03e0c4545a..f93ede2e2f 100644
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -283,9 +283,9 @@ show_warning(PyObject *filename, int lineno, PyObject *text, PyObject
PyFile_WriteString(source_line_str, f_stderr);
PyFile_WriteString("\n", f_stderr);
}
- else
- if (_Py_DisplaySourceLine(f_stderr, filename, lineno, 2) < 0)
- return;
+ else {
+ _Py_DisplaySourceLine(f_stderr, filename, lineno, 2);
+ }
PyErr_Clear();
}