From: Victor Stinner Date: Mon, 15 Jul 2013 22:32:14 +0000 (+0200) Subject: Issue #18408: Fix _Py_DisplaySourceLine() X-Git-Tag: v3.4.0a1~199 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ceceaa00bab93bfd8b0035e4ad482bba74ae4f8e;p=python Issue #18408: Fix _Py_DisplaySourceLine() Report _Py_FindSourceFile() error, so the error is cleared; and clear io.open(filename) exception on failure. --- 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; } }