mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #18408: Fix show_warning(), clear also the exception raised by
_Py_DisplaySourceLine() For example, _PyGC_DumpShutdownStats() calls PyErr_WarnExplicitFormat() while the import machinery does not work anymore, _Py_DisplaySourceLine() fails when trying to import the io module.
This commit is contained in:
parent
f243ee4055
commit
78e2c985ac
1 changed files with 3 additions and 3 deletions
|
@ -283,9 +283,9 @@ show_warning(PyObject *filename, int lineno, PyObject *text, PyObject
|
||||||
PyFile_WriteString(source_line_str, f_stderr);
|
PyFile_WriteString(source_line_str, f_stderr);
|
||||||
PyFile_WriteString("\n", f_stderr);
|
PyFile_WriteString("\n", f_stderr);
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
if (_Py_DisplaySourceLine(f_stderr, filename, lineno, 2) < 0)
|
_Py_DisplaySourceLine(f_stderr, filename, lineno, 2);
|
||||||
return;
|
}
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue