Re: [Numpy-discussion] fromfile() -- help!

2010-01-08 Thread Christopher Barker
Pauli Virtanen wrote: >> if I have NumPyOS_ascii_ftolf right, it should return 0 if it doesn't >> succesfully read a number. However, this looks like it sets the data in >> *ip, even if the return value is zero. > > It may also return EOF (== -1) when encountering end-of-stream. Of > course, I d

Re: [Numpy-discussion] fromfile() -- help!

2010-01-08 Thread Pauli Virtanen
Thu, 07 Jan 2010 17:21:34 -0800, Christopher Barker wrote: [clip] > It does pass on that return value, but, from ctors.c: > > fromfile_next_element(FILE **fp, void *dptr, PyArray_Descr *dtype, >void *NPY_UNUSED(stream_data)) > { > /* the NULL argument is for backwards-

Re: [Numpy-discussion] fromfile() -- help!

2010-01-08 Thread Pauli Virtanen
to, 2010-01-07 kello 17:21 -0800, Christopher Barker kirjoitti: [clip] > if I have NumPyOS_ascii_ftolf right, it should return 0 if it doesn't > succesfully read a number. However, this looks like it sets the data in > *ip, even if the return value is zero. It may also return EOF (== -1) when en

[Numpy-discussion] fromfile() -- help!

2010-01-07 Thread Christopher Barker
OK, I'm trying to dig into the code and figure out how to get it to stop putting in zeros for missing data with fromfile()/fromstring() text reading. It looks like the culprit is this, in arraytypes.c.src: @fn...@_scan(FILE *fp, @type@ *ip, void *NPY_UNUSED(ignore), PyArray_Descr *NPY_UNUSED(