summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_textio.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_textio.c b/Modules/_textio.c
index dbfc8ae..cc229a8 100644
--- a/Modules/_textio.c
+++ b/Modules/_textio.c
@@ -1348,6 +1348,11 @@ TextIOWrapper_read(PyTextIOWrapperObject *self, PyObject *args)
CHECK_CLOSED(self);
+ if (self->decoder == NULL) {
+ PyErr_SetString(PyExc_IOError, "not readable");
+ return NULL;
+ }
+
if (_TextIOWrapper_writeflush(self) < 0)
return NULL;