diff Python/_warnings.c @ 84649:9213313b1a6f

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.
author Victor Stinner <victor.stinner@gmail.com>
date Tue, 16 Jul 2013 01:54:37 +0200
parents 8a5bebea9fec
children df2fdd42b375
line wrap: on
line diff
--- a/Python/_warnings.c	Tue Jul 16 01:02:12 2013 +0200
+++ b/Python/_warnings.c	Tue Jul 16 01:54:37 2013 +0200
@@ -283,9 +283,9 @@
         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();
 }