]> granicus.if.org Git - python/commitdiff
Issue #15365: Make traceback reporting ignore any errors when printing out
authorKristján Valur Jónsson <kristjan@ccpgames.com>
Thu, 19 Jul 2012 21:02:03 +0000 (21:02 +0000)
committerKristján Valur Jónsson <kristjan@ccpgames.com>
Thu, 19 Jul 2012 21:02:03 +0000 (21:02 +0000)
the source line.  Such errors can't be reported anyway.  This makes error
reporting work, even if the "io" module can't be loaded.

Python/traceback.c

index c8b3ee1b63f930e72f378d20d5b1304472de39ba..ce670f3d2cb4dcef17198d251f84429ff6ea8a9e 100644 (file)
@@ -344,7 +344,10 @@ tb_displayline(PyObject *f, PyObject *filename, int lineno, PyObject *name)
     Py_DECREF(line);
     if (err != 0)
         return err;
-    return _Py_DisplaySourceLine(f, filename, lineno, 4);
+    /* ignore errors since we can't report them, can we? */
+    if (_Py_DisplaySourceLine(f, filename, lineno, 4))
+        PyErr_Clear();
+    return err;
 }
 
 static int