summaryrefslogtreecommitdiffstats
path: root/Lib/_pyio.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2009-10-24 12:23:18 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2009-10-24 12:23:18 (GMT)
commitfa94e80f3b2c88d4cdcc809c8e1931e289373e84 (patch)
treeb333dc0a53e75f15d346e19000489c0af27f5982 /Lib/_pyio.py
parentfd42f3099112b8de50c9145af4a43c1cf35887a3 (diff)
downloadcpython-fa94e80f3b2c88d4cdcc809c8e1931e289373e84.zip
cpython-fa94e80f3b2c88d4cdcc809c8e1931e289373e84.tar.gz
cpython-fa94e80f3b2c88d4cdcc809c8e1931e289373e84.tar.bz2
Manual py3k backport: [svn r74158] 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 5f18b12..b0da045 100644
--- a/Lib/_pyio.py
+++ b/Lib/_pyio.py
@@ -773,6 +773,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
"""