diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-07-15 22:32:14 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-07-15 22:32:14 (GMT) |
commit | ceceaa00bab93bfd8b0035e4ad482bba74ae4f8e (patch) | |
tree | 58b3927e28a4c920531bed855e88aaaf9d5913d4 /Python/traceback.c | |
parent | 7eab0d000cd12d76f90d4a80df1b728d3ff94728 (diff) | |
download | cpython-ceceaa00bab93bfd8b0035e4ad482bba74ae4f8e.zip cpython-ceceaa00bab93bfd8b0035e4ad482bba74ae4f8e.tar.gz cpython-ceceaa00bab93bfd8b0035e4ad482bba74ae4f8e.tar.bz2 |
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.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/traceback.c b/Python/traceback.c index c56b23f..8130d4b 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; } } |