summaryrefslogtreecommitdiffstats
path: root/Lib/_pyio.py
diff options
context:
space:
mode:
authorAlexandre Vassalotti <alexandre@peadrop.com>2009-07-22 03:24:36 (GMT)
committerAlexandre Vassalotti <alexandre@peadrop.com>2009-07-22 03:24:36 (GMT)
commitcf76e1ac927cdc14ee321a363e161be24bfff059 (patch)
treed99bc3cf44f52bed75c23d18275c74e3fe38177e /Lib/_pyio.py
parentd2bb18b28165ccc6e4678e8046abe6ea7c9677b3 (diff)
downloadcpython-cf76e1ac927cdc14ee321a363e161be24bfff059.zip
cpython-cf76e1ac927cdc14ee321a363e161be24bfff059.tar.gz
cpython-cf76e1ac927cdc14ee321a363e161be24bfff059.tar.bz2
Issue #6218: Make io.BytesIO and io.StringIO picklable.
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r--Lib/_pyio.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py
index 5458f99..04aed8d 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
"""