[Numpy-discussion] Bug in pickling an ndarray?

Daniel Hyams dhyams at gmail.com
Sat Jun 30 18:33:49 EDT 2012


Hmmm, I wouldn't think that it is correct behavior; I would think that
*any* ndarray arising from pickling would have its .base attribute set to
None.  If not, then who is really the one that owns the data?

It was my understanding that .base should hold a reference to another
ndarray that the data is really coming from, or it's None.  It certainly
shouldn't be some random string, should it?

And yes, it is causing a problem for me, which is why I noticed it.  In my
application, ndarrays can come from various sources, pickling being one of
them.  Later in the app, I was wanting to resize the array, which you
cannot do if the data is not really owned by that array...I had explicit
check for myarray.base==None, which it is not when I get the ndarray from a
pickle.


-- 
Daniel Hyams
dhyams at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20120630/db034d1b/attachment.html>


More information about the NumPy-Discussion mailing list