diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-03-31 23:11:32 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-03-31 23:11:32 (GMT) |
commit | a1b49013f477e83bd1652f651f35c2e4eea54b67 (patch) | |
tree | e56aaae216ffdb72108a7131de3f2dd38ddc8244 /Modules | |
parent | d2ee64d9dd62942488a2f7fff18a21b87da7f7a9 (diff) | |
download | cpython-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.c | 5 |
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; |