Commit ceceaa00 authored by Victor Stinner's avatar Victor Stinner

Issue #18408: Fix _Py_DisplaySourceLine()

Report _Py_FindSourceFile() error, so the error is cleared;
and clear io.open(filename) exception on failure.
parent 7eab0d00
......@@ -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;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment