[NumPy-Tickets] [NumPy] #1743: can not pickle a ufunc

NumPy Trac numpy-tickets@scipy....
Wed Feb 16 16:11:04 CST 2011


#1743: can not pickle a ufunc
---------------------------+------------------------------------------------
 Reporter:  chairmanK      |       Owner:  somebody
     Type:  enhancement    |      Status:  new     
 Priority:  normal         |   Milestone:  2.0.0   
Component:  numpy.core     |     Version:  devel   
 Keywords:  pickle, ufunc  |  
---------------------------+------------------------------------------------
 I can not pickle a ufunc. I would like to be able to do so.


 {{{

 >>> pickle.dumps(numpy.sin)
 ---------------------------------------------------------------------------
 TypeError                                 Traceback (most recent call
 last)
 /home/pythonuser/sandbox/<ipython-input-4-1b00731f1a7d> in <module>()
 ----> 1 pickle.dumps(numpy.sin)

 /usr/lib/python2.6/pickle.pyc in dumps(obj, protocol)
    1364 def dumps(obj, protocol=None):
    1365     file = StringIO()
 -> 1366     Pickler(file, protocol).dump(obj)
    1367     return file.getvalue()
    1368

 /usr/lib/python2.6/pickle.pyc in dump(self, obj)
     222         if self.proto >= 2:
     223             self.write(PROTO + chr(self.proto))
 --> 224         self.save(obj)
     225         self.write(STOP)
     226

 /usr/lib/python2.6/pickle.pyc in save(self, obj)
     304             reduce = getattr(obj, "__reduce_ex__", None)
     305             if reduce:
 --> 306                 rv = reduce(self.proto)
     307             else:
     308                 reduce = getattr(obj, "__reduce__", None)

 /home/steve/sandbox/lib/python2.6/copy_reg.pyc in _reduce_ex(self, proto)
      68     else:
      69         if base is self.__class__:
 ---> 70             raise TypeError, "can't pickle %s objects" %
 base.__name__
      71         state = base(self)
      72     args = (self.__class__, base, state)

 TypeError: can't pickle ufunc objects
 }}}

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1743>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list