You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fromstring/fromfile behave badly with malformed data (Trac #883) #1481
Again, the last value is ignored, but the former ones are not treated as zero; instead, the array is filled with uninitialized data for the missing entries. Note also that neither warning or error is raised; instead, a message is printed to stdout.
Question: what is the correct behavior:
A) Raise ValueError on malformed data.
B) Raise ValueError on malformed data if count is given, otherwise truncate to valid part.
Note that the behavior i 3) has changed as of the current release (1.3.0). With the same file containing "23xxx"
In [1]: fromfile("tmp", sep="x")
Out[1]: array([ 23., 0., 0., 0.])
In [2]: fromfile("tmp", count=5, sep="x")
5 items requested but only 4 read
Out[2]: array([ 23., 0., 0., 0.])
Fromfile and fromstring behave differently, however. At the moment I'm guessing it comes from differences in fromstr_skip_separator and fromfile_skip_separator but I haven't looked closely at these functions yet.
Activity
numpy-gitbot commentedon Oct 19, 2012
Milestone changed to
1.4.0by @cournape on 2009-03-11numpy-gitbot commentedon Oct 19, 2012
@charris wrote on 2009-05-24
Note that the behavior i 3) has changed as of the current release (1.3.0). With the same file containing "23xxx"
Fromfile and fromstring behave differently, however. At the moment I'm guessing it comes from differences in fromstr_skip_separator and fromfile_skip_separator but I haven't looked closely at these functions yet.
numpy-gitbot commentedon Oct 19, 2012
Milestone changed to
Unscheduledby @mwiebe on 2011-03-23charris commentedon Feb 18, 2014
Still open in 1.9-devel.
BUG: fix numpy#4381: precision loss on string -> longdouble conversion