Manual py3k backport: [svn r74158] Issue #6218: Make io.BytesIO and io.StringIO picklable.
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 @@
         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
         """