-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BUG: Make arr = np.fromstring("\n", sep=" ")
return []
.
#18495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
arr = np.fromstring("\n", sep=" ") now retuns []
arr = np.fromstring("\n", sep=" ")
return []
.
@@ -73,7 +73,7 @@ fromstr_next_element(char **s, void *dptr, PyArray_Descr *dtype, | ||
int r = dtype->f->fromstr(*s, dptr, &e, dtype); | ||
/* | ||
* fromstr always returns 0 for basic dtypes; s points to the end of the | ||
* parsed string. If s is not changed an error occurred or the end was | ||
* parsed string. If s is not changed an error occu5trred or the end was | ||
* reached. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could also use a comma after "changed".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, a typo :-(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
With this fix, |
close/reopen |
Looking at this, I'm not convinced the result should be
That may be a problem, but it is a different problem. I'm not yet clear where that value comes from. @seberg Thoughts? This raises a FutureWarning with other separators.
|
Uh, that is strange... It seems you are right and whitespace is parsed as a number and that number is It basically drops out of this: numpy/numpy/core/src/common/numpyos.c Lines 429 to 450 in 6ee4917
Now, that should indicate that an error occurred, by resetting the end-pointer to the start position on error, which then should trigger the error return path here: numpy/numpy/core/src/multiarray/ctors.c Lines 72 to 79 in bb7a31a
Which then has a negative return value indicating an error in the read. All of that seems a bit strange and every single level of that code looks like it could be smoothened a bit more. Maybe we should try and see if we can do a proper deprecation of that The bug seems to be that call to The easier fix should probably to properly propagate a Long story short, the |
Closes #18435.