diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-12-21 14:51:54 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-12-21 14:51:54 (GMT) |
commit | 712cb734bda0227861630b365a97dfec88798c3b (patch) | |
tree | f0e79f0b144395b5a02d32de09dca263e669ee53 /Modules/_io/iobase.c | |
parent | 5255b86fba38a5e22a0991772a3c1bbf3edd66cc (diff) | |
download | cpython-712cb734bda0227861630b365a97dfec88798c3b.zip cpython-712cb734bda0227861630b365a97dfec88798c3b.tar.gz cpython-712cb734bda0227861630b365a97dfec88798c3b.tar.bz2 |
Issue #20037: Avoid crashes when doing text I/O late at interpreter shutdown.
Diffstat (limited to 'Modules/_io/iobase.c')
-rw-r--r-- | Modules/_io/iobase.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Modules/_io/iobase.c b/Modules/_io/iobase.c index 1b7cb0f..e372990 100644 --- a/Modules/_io/iobase.c +++ b/Modules/_io/iobase.c @@ -69,7 +69,9 @@ _Py_IDENTIFIER(read); static PyObject * iobase_unsupported(const char *message) { - PyErr_SetString(IO_STATE->unsupported_operation, message); + _PyIO_State *state = IO_STATE(); + if (state != NULL) + PyErr_SetString(state->unsupported_operation, message); return NULL; } |