summaryrefslogtreecommitdiff
path: root/Python/traceback.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-16 00:32:14 +0200
committerVictor Stinner <victor.stinner@gmail.com>2013-07-16 00:32:14 +0200
commit90550e88978f25e2c4452493b5323c7de260fdc4 (patch)
tree0bdb3831dc999178dd2455ffbffaaee796148d45 /Python/traceback.c
parent549b0ef3ee5549644eda077e4eb083563de0b9ee (diff)
downloadcpython-90550e88978f25e2c4452493b5323c7de260fdc4.tar.gz
Issue #18408: Fix _Py_DisplaySourceLine()
Report _Py_FindSourceFile() error, so the error is cleared; and clear io.open(filename) exception on failure.
Diffstat (limited to 'Python/traceback.c')
-rw-r--r--Python/traceback.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/traceback.c b/Python/traceback.c
index c56b23f6cc..8130d4bcec 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -246,10 +246,12 @@ _Py_DisplaySourceLine(PyObject *f, PyObject *filename, int lineno, int indent)
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;
}
}