summaryrefslogtreecommitdiffstats
path: root/Python/_warnings.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-15 23:54:37 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-15 23:54:37 (GMT)
commit78e2c985ac4b43fc0c0595197d7d255358930fda (patch)
tree6214bae8799476c127d90336dd6d2d9d9f0e9524 /Python/_warnings.c
parentf243ee4055c8ed334e048e494814d557a02f72b3 (diff)
downloadcpython-78e2c985ac4b43fc0c0595197d7d255358930fda.zip
cpython-78e2c985ac4b43fc0c0595197d7d255358930fda.tar.gz
cpython-78e2c985ac4b43fc0c0595197d7d255358930fda.tar.bz2
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/_warnings.c')
-rw-r--r--Python/_warnings.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c
index 03e0c45..f93ede2 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();
}