[Python-checkins] cpython: Issue #18408: Fix _Py_DisplaySourceLine()

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


http://hg.python.org/cpython/rev/2e42c0a39321
changeset:   84647:2e42c0a39321
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue Jul 16 00:32:14 2013 +0200
summary:
  Issue #18408: Fix _Py_DisplaySourceLine()

Report _Py_FindSourceFile() error, so the error is cleared;
and clear io.open(filename) exception on failure.

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


diff --git a/Python/traceback.c b/Python/traceback.c
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -246,10 +246,12 @@
     binary = _PyObject_CallMethodId(io, &PyId_open, "Os", filename, "rb");
 
     if (binary == NULL) {
+        PyErr_Clear();
+
         binary = _Py_FindSourceFile(filename, buf, sizeof(buf), io);
         if (binary == NULL) {
             Py_DECREF(io);
-            return 0;
+            return -1;
         }
     }
 

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


More information about the Python-checkins mailing list