I am having trouble pickling (and then unpickling) an ndarray. Upon unpickling, the "base" attribute of the ndarray is set to some very strange string ("base" was None when the ndarray was pickled, so it should remain None).<div>

<br></div><div>I have tried on various platforms and versions of numpy, with inconclusive results:</div><div><br></div><div><div># tested: Linux (Suse 11.1), numpy 1.5.1       BUG</div><div>#         Linux (Suse 11,0), numpy 1.6.1       OK</div>

<div>#         Linux (Mint Debian), numpy 1.6.1     BUG</div><div>#         Linux (Mint Debian), numpy 1.6.2     BUG</div><div>#         OSX (Snow Leopard),  numpy 1.5.1rc1  BUG</div><div>#         OSX (Snow Leopard),  numpy 1.6.2     BUG</div>

<div>#         Windows 7,           numpy 1.4.1     OK</div></div><div><br></div><div>I have attached a script below that can be used to check for the problem; I suppose that this is a bug report, unless I'm doing something terribly wrong or my expectations for the base attribute are off.</div>

<div><br></div><div>---------------- cut here ---------------------------------</div><div><div># this little demo shows a problem with the base attribute of an ndarray, when</div><div># pickling.  Before pickling, dset.base is None, but after pickling, it is some</div>

<div># strange string.</div><div><br></div><div>import cPickle as pickle</div><div>import numpy</div><div>print numpy.__version__</div><div>#import pickle</div><div><br></div><div>dset = numpy.ones((2,2))</div><div><br></div>

<div>print "BEFORE PICKLING"</div><div>print dset</div><div>print "base = ",dset.base</div><div>print dset.flags</div><div><br></div><div># pickle.</div><div>s = pickle.dumps(dset)</div><div><br></div>

<div># now unpickle.</div><div>dset = pickle.loads(s)</div><div><br></div><div>print "AFTER PICKLING AND THEN IMMEDIATELY UNPICKLING"</div><div>print dset</div><div>print "base = ",dset.base</div><div>

print dset.flags</div><div><br></div></div><div><br>-- <br>Daniel Hyams<br><a href="mailto:dhyams@gmail.com" target="_blank">dhyams@gmail.com</a><br>
</div>