Message231268
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 |
|
Date |
User |
Action |
Args |
2014-11-17 07:41:25 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, pitrou, alexandre.vassalotti |
2014-11-17 07:41:25 | serhiy.storchaka | set | messageid: <1416210085.6.0.932097721403.issue22890@psf.upfronthosting.co.za> |
2014-11-17 07:41:25 | serhiy.storchaka | link | issue22890 messages |
2014-11-17 07:41:25 | serhiy.storchaka | create | |
|