Re: [Numpy-discussion] major bug in fromstring, ascii mode

2008-01-28 Thread Eric Firing
Charles R Harris wrote: > > > On Jan 28, 2008 4:09 PM, Eric Firing <[EMAIL PROTECTED] > > wrote: > > Charles R Harris wrote: > > > Reading the code in arraytypes.inc.src and multiarraymodule.c, it > > appears that numpy is using strtol(str, &tail

Re: [Numpy-discussion] major bug in fromstring, ascii mode

2008-01-28 Thread Charles R Harris
On Jan 28, 2008 4:09 PM, Eric Firing <[EMAIL PROTECTED]> wrote: > Charles R Harris wrote: > > > Reading the code in arraytypes.inc.src and multiarraymodule.c, it > > appears that numpy is using strtol(str, &tailptr, 0) for the string > to > > integer conversion. Calling strtol with BAS

Re: [Numpy-discussion] major bug in fromstring, ascii mode

2008-01-28 Thread Eric Firing
Charles R Harris wrote: > Reading the code in arraytypes.inc.src and multiarraymodule.c, it > appears that numpy is using strtol(str, &tailptr, 0) for the string to > integer conversion. Calling strtol with BASE == 0 enables the automatic > base detection from the prefix. > >

Re: [Numpy-discussion] major bug in fromstring, ascii mode

2008-01-27 Thread Charles R Harris
On Jan 27, 2008 3:19 PM, Pauli Virtanen <[EMAIL PROTECTED]> wrote: > > su, 2008-01-27 kello 13:48 -0700, Charles R Harris kirjoitti: > [clip] > > > > I don't think the problem is scanf, at least not here. The following > code snippet works fine for me. > > > > Reading the code in arraytypes.inc.sr

Re: [Numpy-discussion] major bug in fromstring, ascii mode

2008-01-27 Thread Pauli Virtanen
su, 2008-01-27 kello 13:48 -0700, Charles R Harris kirjoitti: [clip] > > I don't think the problem is scanf, at least not here. The following code > snippet works fine for me. > Reading the code in arraytypes.inc.src and multiarraymodule.c, it appears that numpy is using strtol(str, &tailptr, 0

Re: [Numpy-discussion] major bug in fromstring, ascii mode

2008-01-27 Thread Charles R Harris
On Jan 27, 2008 12:40 PM, Eric Firing <[EMAIL PROTECTED]> wrote: > Pauli Virtanen wrote: > > > That is it exactly. The code in core/src/arraytypes.inc.src is using > scanf, and scanf tries hard to recognize integers specified in different > ways. So, what caught me is a feature, not a bug, and

Re: [Numpy-discussion] major bug in fromstring, ascii mode

2008-01-27 Thread Eric Firing
Pauli Virtanen wrote: > su, 2008-01-27 kello 01:16 -0700, Charles R Harris kirjoitti: >> >> On Jan 26, 2008 11:30 PM, Eric Firing <[EMAIL PROTECTED]> wrote: >> In the course of trying to parse ascii times, I ran into a >> puzzling bug. >> Sometimes it works as expected: >>

Re: [Numpy-discussion] major bug in fromstring, ascii mode

2008-01-27 Thread Pauli Virtanen
su, 2008-01-27 kello 01:16 -0700, Charles R Harris kirjoitti: > > > On Jan 26, 2008 11:30 PM, Eric Firing <[EMAIL PROTECTED]> wrote: > In the course of trying to parse ascii times, I ran into a > puzzling bug. > Sometimes it works as expected: > > In [31

Re: [Numpy-discussion] major bug in fromstring, ascii mode

2008-01-27 Thread Gabriel J.L. Beckers
Doesn't work here: In [1]: import numpy as npy In [2]: npy.fromstring('23:09:01', dtype=int, sep=':') Out[2]: array([23, 0]) In [3]: npy.__version__ Out[3]: '1.0.5.dev4722' In [4]: npy.fromstring('23:09:01', dtype=int, sep=':', count=3) Out[4]: array([ 23, 0, 151904160]) ... Pe

Re: [Numpy-discussion] major bug in fromstring, ascii mode

2008-01-27 Thread Charles R Harris
On Jan 26, 2008 11:30 PM, Eric Firing <[EMAIL PROTECTED]> wrote: > In the course of trying to parse ascii times, I ran into a puzzling bug. > Sometimes it works as expected: > > In [31]:npy.fromstring('23:19:01', dtype=int, sep=':') > Out[31]:array([23, 19, 1]) > > But sometimes it doesn't: > >

[Numpy-discussion] major bug in fromstring, ascii mode

2008-01-26 Thread Eric Firing
In the course of trying to parse ascii times, I ran into a puzzling bug. Sometimes it works as expected: In [31]:npy.fromstring('23:19:01', dtype=int, sep=':') Out[31]:array([23, 19, 1]) But sometimes it doesn't: In [32]:npy.fromstring('23:09:01', dtype=int, sep=':') Out[32]:array([23, 0])