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

John Hunter jdh2358@gmail....
Tue May 20 11:57:03 CDT 2008

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',

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

More information about the Numpy-discussion mailing list