summaryrefslogtreecommitdiffstats
path: root/Python/traceback.c
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2012-07-19 21:02:03 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2012-07-19 21:02:03 (GMT)
commitc5963d38429595ed334e129096815a6f56e81035 (patch)
tree029f22944aed7c37fd2633bd8589987e8f65e546 /Python/traceback.c
parent26fe37dd3f5b994722eb093f95e917282368d7da (diff)
downloadcpython-c5963d38429595ed334e129096815a6f56e81035.zip
cpython-c5963d38429595ed334e129096815a6f56e81035.tar.gz
cpython-c5963d38429595ed334e129096815a6f56e81035.tar.bz2
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.
Diffstat (limited to 'Python/traceback.c')
-rw-r--r--Python/traceback.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index c8b3ee1..ce670f3 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -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