summaryrefslogtreecommitdiff
path: root/Python/traceback.c
diff options
context:
space:
mode:
authorKristj?n Valur J?nsson <kristjan@ccpgames.com>2012-07-19 21:02:03 +0000
committerKristj?n Valur J?nsson <kristjan@ccpgames.com>2012-07-19 21:02:03 +0000
commitb8c8514288c6cc57844b0b966a5d5bf9c7f23e7a (patch)
tree10b65b436f9896b7c49c5657060d1fc7961d2df6 /Python/traceback.c
parent7c7dfc4a769fb7103f27a9a37a9a989b41dcb269 (diff)
downloadcpython-b8c8514288c6cc57844b0b966a5d5bf9c7f23e7a.tar.gz
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 c8b3ee1b63..ce670f3d2c 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