[Numpy-discussion] numpy.save bug on solaris x86 w/ nans and objects

Charles R Harris charlesr.harris at gmail.com
Tue May 20 13:13:02 EDT 2008


On Tue, May 20, 2008 at 10:57 AM, John Hunter <jdh2358 at gmail.com> wrote:

> I have a record array w/ dates (O4) and floats.  If some of these
> floats are NaN, np.save crashes (on my solaris platform but not on a
> linux machine I tested on).  Here is the code that produces the bug:
>
> In [1]: pwd
> Out[1]: '/home/titan/johnh/python/svn/matplotlib/matplotlib/examples/data'
>
> In [2]: import matplotlib.mlab as mlab
>
> In [3]: import numpy as np
>
> In [4]: r = mlab.csv2rec('aapl.csv')
>
> In [5]: r.dtype
> Out[5]: dtype([('date', '|O4'), ('open', '<f8'), ('high', '<f8'),
> ('low', '<f8'), ('close', '<f8'), ('volume', '<i4'), ('adj_close',
> '<f8')])
>
> In [6]: r.close[100:] = np.nan
>
> In [7]: r.close
> Out[7]: array([ 124.63,  127.46,  129.4 , ...,     NaN,     NaN,     NaN])
>
> In [8]: np.save('mydata.npy', r)
> ------------------------------------------------------------
> Traceback (most recent call last):
>  File "<ipython console>", line 1, in ?
>  File "/home/titan/johnh/dev/lib/python2.4/site-packages/numpy/lib/io.py",
> line 158, in save
>   format.write_array(fid, arr)
>  File
> "/home/titan/johnh/dev/lib/python2.4/site-packages/numpy/lib/format.py",
> line 272, in write_array
>   cPickle.dump(array, fp, protocol=2)
> SystemError: frexp() result out of range
>
>
> In [9]: np.__version__
> Out[9]: '1.2.0.dev5136'
>
> In [10]: !uname -a
> SunOS flag 5.10 Generic_118855-15 i86pc i386 i86pc


Looks like we need to add a test for this before release. But I'm off to
work.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080520/9d25174e/attachment.html>


More information about the NumPy-Discussion mailing list