This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients alexandre.vassalotti, pitrou, serhiy.storchaka
Date 2014-11-17.07:41:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1416210085.6.0.932097721403.issue22890@psf.upfronthosting.co.za>
In-reply-to
Content
StringIO.StringIO is pickleable and unpickleable on 2.7 but is not unpickleable on 3.x.

Python 2.7:
>>> import pickle, StringIO
>>> pickle.dumps(StringIO.StringIO('abc'), 2)
'\x80\x02(cStringIO\nStringIO\nq\x00oq\x01}q\x02(U\tsoftspaceq\x03K\x00U\x07buflistq\x04]q\x05U\x03posq\x06K\x00U\x03lenq\x07K\x03U\x06closedq\x08\x89U\x03bufq\tU\x03abcq\nub.'
>>> pickle.loads(b'\x80\x02(cStringIO\nStringIO\nq\x00oq\x01}q\x02(U\tsoftspaceq\x03K\x00U\x07buflistq\x04]q\x05U\x03posq\x06K\x00U\x03lenq\x07K\x03U\x06closedq\x08\x89U\x03bufq\tU\x03abcq\nub.')
<StringIO.StringIO instance at 0xb70c122c>

On 3.x I got an error:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: _io.StringIO.__setstate__ argument should be 4-tuple, got dict
History
Date User Action Args
2014-11-17 07:41:25serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, alexandre.vassalotti
2014-11-17 07:41:25serhiy.storchakasetmessageid: <1416210085.6.0.932097721403.issue22890@psf.upfronthosting.co.za>
2014-11-17 07:41:25serhiy.storchakalinkissue22890 messages
2014-11-17 07:41:25serhiy.storchakacreate