summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2009-03-31 23:11:32 (GMT)
committerBenjamin Peterson <benjamin@python.org>2009-03-31 23:11:32 (GMT)
commita1b49013f477e83bd1652f651f35c2e4eea54b67 (patch)
treee56aaae216ffdb72108a7131de3f2dd38ddc8244 /Modules
parentd2ee64d9dd62942488a2f7fff18a21b87da7f7a9 (diff)
downloadcpython-a1b49013f477e83bd1652f651f35c2e4eea54b67.zip
cpython-a1b49013f477e83bd1652f651f35c2e4eea54b67.tar.gz
cpython-a1b49013f477e83bd1652f651f35c2e4eea54b67.tar.bz2
fix TextIOWrapper.read() when the buffer is not readable #5628
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;