[Python-checkins] cpython: Issue #15365: Make traceback reporting ignore any errors when printing out

kristjan.jonsson python-checkins at python.org
Thu Jul 19 23:02:59 CEST 2012


http://hg.python.org/cpython/rev/54524897fafc
changeset:   78185:54524897fafc
user:        Kristján Valur Jónsson <kristjan at ccpgames.com>
date:        Thu Jul 19 21:02:03 2012 +0000
summary:
  Issue #15365:  Make traceback reporting ignore any errors when printing out
the source line.  Such errors can't be reported anyway.  This makes error
reporting work, even if the "io" module can't be loaded.

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


diff --git a/Python/traceback.c b/Python/traceback.c
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -344,7 +344,10 @@
     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

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


More information about the Python-checkins mailing list