diff options
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r-- | Lib/_pyio.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py index 5458f990b7..04aed8d43a 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -765,6 +765,11 @@ class BytesIO(BufferedIOBase): self._buffer = buf self._pos = 0 + def __getstate__(self): + if self.closed: + raise ValueError("__getstate__ on closed file") + return self.__dict__.copy() + def getvalue(self): """Return the bytes value (contents) of the buffer """ |