[Numpy-discussion] possible bug: pickling MaskedArrays with the latest cvs version of MA

Paul F. Dubois paul at pfdubois.com
Sat Mar 24 06:28:56 EST 2001


I don't know if this will help but the change is that each instance stores
some (unbound) method objects. In the previous release these were stored in
the class object but it turns out that isn't right wrt inheritance.

I haven't much experience with pickling but I will try adding a pickle test
to my test suite and see if I can figure this out.

-----Original Message-----
From: numpy-discussion-admin at lists.sourceforge.net
[mailto:numpy-discussion-admin at lists.sourceforge.net]On Behalf Of Tavis
Rudd
Sent: Friday, March 23, 2001 7:28 PM
To: numpy-discussion at lists.sourceforge.net
Subject: [Numpy-discussion] possible bug: pickling MaskedArrays with the
latest cvs version of MA


Hi,
I'm having difficulty pickling with the new implementation of
activeattributes in the cvs version of MA.

With the standard pickle module I get the this traceback:
>>> import MA
>>> a = MA.arange(3400)
>>> fp = open('a.pickle','w')
>>> from pickle import dump, load
>>> dump(a,fp)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python2.1/pickle.py", line 932, in dump
    Pickler(file, bin).dump(object)
  File "/usr/local/lib/python2.1/pickle.py", line 109, in dump
    self.save(object)
  File "/usr/local/lib/python2.1/pickle.py", line 211, in save
    f(self, object)
  File "/usr/local/lib/python2.1/pickle.py", line 471, in save_inst
    getstate = object.__getstate__
  File "/usr/local/lib/python2.1/site-packages/MA/activeattr.py", line 39,
in
__getattr__
    return d['_get'](self, name)
  File "/usr/local/lib/python2.1/site-packages/MA/activeattr.py", line 80,
in
basic_get
    return self.__dict__[name]
KeyError: __getstate__


With the cPickle module I'm getting:

>>> from cPickle import dump, load
>>> dump(a,file)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
cPickle.UnpickleableError: Cannot pickle <type 'instance method'> objects
>>>

This is with python 2.1b1 and the latest cvs version of Numeric.
Has anyone else had this problem?
Tavis

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/numpy-discussion





More information about the NumPy-Discussion mailing list