[pypy-dev] Can't pickle a numpy object?

mike c coolbutuseless at gmail.com
Thu Oct 6 06:55:28 CEST 2011

Hi there,
I'm new to pypy and trying it out on some numerical projects and the speed
of pypy+numpy is about 4x faster than cpython+numpy. Pretty impressive!

However, I want to pickle some of my numpy objects and I get the
error: TypeError: can't pickle numarray objects  (full error is included

I realise that the numpy implementation in pypy is currently a
proof-of-concept, and so I was wondering what I would have to change to get
numarray's to be pickle-able.  As simple as adding a something like a
__pickle__ method to numarray?  Or is the problem deeper than that?


>>>> import pickle, numpy
>>>> a = numpy.array([1,2,3])
>>>> pickle.dumps(a)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/mike/pypy-1.6/lib-python/modified-2.7/pickle.py", line 1423,
in dumps
    Pickler(file, protocol).dump(obj)
  File "/Users/mike/pypy-1.6/lib-python/modified-2.7/pickle.py", line 224,
in dump
  File "/Users/mike/pypy-1.6/lib-python/modified-2.7/pickle.py", line 306,
in save
    rv = reduce(self.proto)
  File "/Users/mike/pypy-1.6/lib-python/2.7/copy_reg.py", line 70, in
    raise TypeError, "can't pickle %s objects" % base.__name__
TypeError: can't pickle numarray objects
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20111006/3b50808f/attachment.html>

More information about the pypy-dev mailing list