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.

classification
Title: exception when unpickling array.array objects
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: rhettinger, sjmachin
Priority: normal Keywords:

Created on 2005-09-04 10:19 by sjmachin, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg26207 - (view) Author: John Machin (sjmachin) Date: 2005-09-04 10:19
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]
>>>
msg26208 - (view) Author: John Machin (sjmachin) Date: 2005-09-04 10:46
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.
msg26209 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2005-09-09 19:54
Logged In: YES 
user_id=80475

Duplicate of 1281383.

History
Date User Action Args
2022-04-11 14:56:12adminsetgithub: 42339
2005-09-04 10:19:13sjmachincreate