-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BUG: random: Revert gh-14458 and refix gh-14557. #14490
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
Conversation
@@ -3517,7 +3517,7 @@ cdef class RandomState: | |||
# Convert to int64, if necessary, to use int64 infrastructure | |||
ongood = ongood.astype(np.int64) | |||
onbad = onbad.astype(np.int64) | |||
onbad = onbad.astype(np.int64) | |||
onsample = onsample.astype(np.int64) |
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.
Nice catch
onsample = <np.ndarray>np.PyArray_FROM_OTF(nsample, np.NPY_INT64, np.NPY_ALIGNED) | ||
ongood = <np.ndarray>np.PyArray_FROM_OTF(ngood, np.NPY_LONG, np.NPY_ALIGNED) | ||
onbad = <np.ndarray>np.PyArray_FROM_OTF(nbad, np.NPY_LONG, np.NPY_ALIGNED) | ||
onsample = <np.ndarray>np.PyArray_FROM_OTF(nsample, np.NPY_LONG, np.NPY_ALIGNED) |
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.
Can you remind me why we're using long
here instead of int64
?
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.
Legacy. The original random code was written using C long integers. This code is supposed to preserve the old behavior.
Thanks Warren. |
Reverts gh-14458 and instead fixes the actual incorrect code.
This fixes a regression in 1.17 and does not result in a change in behavior of the legacy random code.