[NumPy-Tickets] [NumPy] #1897: Pickling a numpy.ma.MaskedConstant fails

NumPy Trac numpy-tickets@scipy....
Tue May 22 16:47:15 CDT 2012


#1897: Pickling a numpy.ma.MaskedConstant fails
----------------------+-----------------------------------------------------
 Reporter:  jpaalasm  |       Owner:  pierregm    
     Type:  defect    |      Status:  needs_review
 Priority:  high      |   Milestone:  Unscheduled 
Component:  numpy.ma  |     Version:  1.6.1       
 Keywords:            |  
----------------------+-----------------------------------------------------

Comment(by iMichka):

 I just tested your patch, but you will get an error when unpickling :


 {{{
 >>> import numpy; import pickle
 >>> numpy.version.version
 '1.6.1'
 >>> ma = numpy.ma.MaskedArray([0, 0, 0], mask=True)
 >>> m = ma[0]
 >>> m
 masked
 >>> dump = pickle.dumps(m)
 >>> pickle.loads(dump)
 Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py",
 line 1382, in loads
     return Unpickler(file).load()
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py",
 line 858, in load
     dispatch[key](self)
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/pickle.py",
 line 1133, in load_reduce
     value = func(*args)
   File
 "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
 /site-packages/numpy/ma/core.py", line 5494, in _mareconstruct
     return subtype.__new__(subtype, _data, mask=_mask, dtype=basetype,)
 TypeError: __new__() takes exactly 1 argument (4 given)
 }}}

 I was not able to correct this error. Could you check if you also get this
 error ?

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1897#comment:3>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list