Bugs item #1281556, was opened at 2005-09-04 05:19 Message generated for change (Comment added) made by rhettinger You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1281556&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.4 >Status: Closed >Resolution: Duplicate Priority: 5 Submitted By: John Machin (sjmachin) Assigned to: Nobody/Anonymous (nobody) Summary: exception when unpickling array.array objects Initial Comment: Note 1: same error for pickle and cPickle Note 2: pickle.dumps and cPickle.dumps produce different results [see below] -- is this expected? Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import pickle, cPickle, array >>> ia = array.array('i',[3,2,1]) >>> ia array('i', [3, 2, 1]) >>> pia = pickle.dumps(ia, -1) >>> pia '\x80\x02carray\narray\nq\x00)\x81q\x01.' >>> cia = cPickle.dumps(ia, -1) >>> pia == cia False >>> cia '\x80\x02carray\narray\nq\x01)\x81q\x02.' >>> pickle.loads(pia) Traceback (most recent call last): File "<stdin>", line 1, in ? File "C:\Python24\lib\pickle.py", line 1394, in loads return Unpickler(file).load() File "C:\Python24\lib\pickle.py", line 872, in load dispatch[key](self) File "C:\Python24\lib\pickle.py", line 1097, in load_newobj obj = cls.__new__(cls, *args) TypeError: array() takes at least 1 argument (0 given) >>> pickle.loads(cia) [same as above] >>> cPickle.loads(pia) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: array() takes at least 1 argument (0 given) >>> cPickle.loads(cia) [same as above] >>> ---------------------------------------------------------------------- >Comment By: Raymond Hettinger (rhettinger) Date: 2005-09-09 14:54 Message: Logged In: YES user_id=80475 Duplicate of 1281383. ---------------------------------------------------------------------- Comment By: John Machin (sjmachin) Date: 2005-09-04 05:46 Message: Logged In: YES user_id=480138 Refer bug report 1281383. Please fix the bug in Python 2.4: if array objects are not pickleable in 2.4, then pickle and cPickle should raise a PickleError [like they used to in earlier versions] -- instead of guessing wrongly and misleading callers into thinking that the objects can be pickled. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1281556&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com