diff --git a/Python/traceback.c b/Python/traceback.c --- a/Python/traceback.c +++ b/Python/traceback.c @@ -344,7 +344,10 @@ Py_DECREF(line); if (err != 0) return err; - return _Py_DisplaySourceLine(f, filename, lineno, 4); + /* ignore IO errors here, IO may not be ready yet */ + if ( _Py_DisplaySourceLine(f, filename, lineno, 4) ) + PyErr_Clear(); + return err; } static int