[SciPy-user] Bug in scipy.io.fread?

Travis Oliphant oliphant.travis at ieee.org
Thu Dec 29 13:29:15 CST 2005

Paul Ray wrote:

>I've compiled scipy_core and scipy from the current (yesterday, Rev  
>1502) svn versions.
>I'm running Mac OS X 10.4.3, with a fink-installed python2.4.
>The new scipy builds and installs just fine, and all the unit tests I  
>tried worked fine.  However, I get a Bus Error from the following  
>simple program:
>import scipy
>import scipy.io
>print 'Opening test.dat for writing'
>outfile = open('test.dat', mode='wb')
>a = scipy.arange(1024.0,dtype='f')
>print 'Writing array'
>scipy.io.fwrite(outfile, 1024, a, 'f')
>print 'Closing file'
>print 'Opening test.dat for reading'
>infile = open('test.dat', mode='rb')
>print 'Reading chunk'
>tmpchunk = scipy.io.fread(infile, 1024, 'f')
>print 'Done :',tmpchunk[0:10]

Thanks for catching this.  It was a faulty DECREF of the data-type 
descriptor (new feature added in the past two weeks) which should have 
been XDECREF.   There were actually a few more fixes to data-type 
descriptors needed.  They are objects now and should be reference 
counted.  I checked in the changes.  The file was reading and writing 
fine, the problem happened right before returning when a NULL pointer 
was being DECREF'd.



More information about the SciPy-user mailing list