[Python-checkins] cpython: Issue #18408: Fix show_warning(), clear also the exception raised by

victor.stinner python-checkins at python.org
Tue Jul 16 02:02:15 CEST 2013


http://hg.python.org/cpython/rev/9213313b1a6f
changeset:   84649:9213313b1a6f
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Jul 16 01:54:37 2013 +0200
summary:
  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.

files:
  Python/_warnings.c |  6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)


diff --git a/Python/_warnings.c b/Python/_warnings.c
--- a/Python/_warnings.c
+++ b/Python/_warnings.c
@@ -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();
 }
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list