Manual py3k backport: [svn r74158] Issue #6218: Make io.BytesIO and io.StringIO picklable.

This commit is contained in:
Antoine Pitrou 2009-10-24 12:23:18 +00:00
parent fd42f30991
commit fa94e80f3b
5 changed files with 415 additions and 18 deletions

View file

@ -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
"""