summaryrefslogtreecommitdiffstats
path: root/Modules/_io/iobase.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/_io/iobase.c')
-rw-r--r--Modules/_io/iobase.c4
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;
}