diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_io/bufferedio.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/_io/bufferedio.c b/Modules/_io/bufferedio.c index 2c90648..23ba3df 100644 --- a/Modules/_io/bufferedio.c +++ b/Modules/_io/bufferedio.c @@ -871,6 +871,8 @@ _io__Buffered_peek_impl(buffered *self, Py_ssize_t size) PyObject *res = NULL; CHECK_INITIALIZED(self) + CHECK_CLOSED(self, "peek of closed file") + if (!ENTER_BUFFERED(self)) return NULL; @@ -947,6 +949,9 @@ _io__Buffered_read1_impl(buffered *self, Py_ssize_t n) "read length must be positive"); return NULL; } + + CHECK_CLOSED(self, "read of closed file") + if (n == 0) return PyBytes_FromStringAndSize(NULL, 0); |