mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #20037: Avoid crashes when doing text I/O late at interpreter shutdown.
This commit is contained in:
parent
5255b86fba
commit
712cb734bd
9 changed files with 96 additions and 8 deletions
|
@ -493,8 +493,10 @@ err_closed(void)
|
|||
static PyObject *
|
||||
err_mode(char *action)
|
||||
{
|
||||
PyErr_Format(IO_STATE->unsupported_operation,
|
||||
"File not open for %s", action);
|
||||
_PyIO_State *state = IO_STATE();
|
||||
if (state != NULL)
|
||||
PyErr_Format(state->unsupported_operation,
|
||||
"File not open for %s", action);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue