-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
BUG: Better check for invalid bounds in np.random.uniform. #8227
Conversation
e4814a0
to
2cab7c9
Compare
Could you fix up the commit message? All lines should be <=72 characters with hard breaks and a blank line after the summary line. Something like
It would be extraordinary if the extended explanation were too detailed ;) |
139eb03
to
341ed78
Compare
fscale = PyFloat_AsDouble(temp[i]) | ||
if not npy_isfinite(fscale): | ||
raise OverflowError('Range exceeds valid bounds') | ||
|
||
Py_INCREF(temp) # needed to get around Pyrex's automatic reference-counting | ||
# rules because EnsureArray steals a reference | ||
odiff = <ndarray>PyArray_EnsureArray(temp) |
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.
You could just use not np.any(np.isfinite(odiff))
here rather than manually looping. This is used multiple places, e.g.,
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.
Sure, done.
341ed78
to
0d18ae1
Compare
Also check for invalid bounds when low= and high= are arraylike rather than scalar (closes numpy#8226)
0d18ae1
to
f5bb42f
Compare
Thanks @alimuldal . |
Closes #8226