Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 78e2c98

Browse files
committed
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.
1 parent f243ee4 commit 78e2c98

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

Python/_warnings.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,9 @@ show_warning(PyObject *filename, int lineno, PyObject *text, PyObject
283283
PyFile_WriteString(source_line_str, f_stderr);
284284
PyFile_WriteString("\n", f_stderr);
285285
}
286-
else
287-
if (_Py_DisplaySourceLine(f_stderr, filename, lineno, 2) < 0)
288-
return;
286+
else {
287+
_Py_DisplaySourceLine(f_stderr, filename, lineno, 2);
288+
}
289289
PyErr_Clear();
290290
}
291291

0 commit comments

Comments
 (0)