Issue #6218: Make io.BytesIO and io.StringIO picklable.

This commit is contained in:
Alexandre Vassalotti 2009-07-22 03:24:36 +00:00
parent d2bb18b281
commit cf76e1ac92
5 changed files with 410 additions and 16 deletions

View file

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