Issue #10180: Pickling file objects is now explicitly forbidden, since

unpickling them produced nonsensical results.
This commit is contained in:
Antoine Pitrou 2010-11-05 21:15:39 +00:00
parent 4a5f9677f3
commit 243757eb79
6 changed files with 57 additions and 0 deletions

View file

@ -747,6 +747,10 @@ class _BufferedIOMixin(BufferedIOBase):
def mode(self):
return self.raw.mode
def __getstate__(self):
raise TypeError("can not serialize a '{0}' object"
.format(self.__class__.__name__))
def __repr__(self):
clsname = self.__class__.__name__
try: