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 sbt
Recipients sbt
Date 2011-12-09.13:25:03
SpamBayes Score 5.973e-13
Marked as misclassified No
Message-id <1323437104.23.0.789258355405.issue13566@psf.upfronthosting.co.za>
In-reply-to
Content
If you pickle an array object on python 3 the typecode is encoded as a unicode string rather than as a byte string.  This makes python 2 reject the pickle.

#########################################

Python 3.3.0a0 (default, Dec  8 2011, 17:56:13) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pickle, array
>>> pickle.dumps(array.array('i', [1,2,3]), 2)
b'\x80\x02carray\narray\nq\x00X\x01\x00\x00\x00iq\x01]q\x02(K\x01K\x02K\x03e\x86q\x03Rq\x04.'

#########################################

Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pickle
>>> pickle.loads(b'\x80\x02carray\narray\nq\x00X\x01\x00\x00\x00iq\x01]q\x02(K\x01K\x02K\x03e\x86q\x03Rq\x04.')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Python27\lib\pickle.py", line 1382, in loads
    return Unpickler(file).load()
  File "c:\Python27\lib\pickle.py", line 858, in load
    dispatch[key](self)
  File "c:\Python27\lib\pickle.py", line 1133, in load_reduce
    value = func(*args)
TypeError: must be char, not unicode
History
Date User Action Args
2011-12-09 13:25:04sbtsetrecipients: + sbt
2011-12-09 13:25:04sbtsetmessageid: <1323437104.23.0.789258355405.issue13566@psf.upfronthosting.co.za>
2011-12-09 13:25:03sbtlinkissue13566 messages
2011-12-09 13:25:03sbtcreate