diff Python/traceback.c @ 84647:2e42c0a39321

Issue #18408: Fix _Py_DisplaySourceLine() Report _Py_FindSourceFile() error, so the error is cleared; and clear io.open(filename) exception on failure.
author Victor Stinner <victor.stinner@gmail.com>
date Tue, 16 Jul 2013 00:32:14 +0200
parents ef5dd5bda323
children 19a8c3e36cfb
line wrap: on
line diff
--- a/Python/traceback.c	Mon Jul 15 21:16:27 2013 +0200
+++ b/Python/traceback.c	Tue Jul 16 00:32:14 2013 +0200
@@ -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;
         }
     }