-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
BUG: random.hypergeometic assumes npy_long is npy_int64, hangs ppc64 #14458
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
Looks obviously correct, thanks. Might be worth looking for other similar cases. |
It looks like the actual source of the bug was down about 20 lines in the code:
Note that instead of converting I think the change in this PR is still fine, but now we can do a little more clean up. I'll submit a PR. |
It should be noted that this PR introduces a change in behavior for systems where a C long is 32 bits, but only in cases where the inputs exceed the limits of a 32 bit integer. In the original version of the code, the initial conversion to long would result in these large values being set to 0 in the calls to |
I think I would vote for considering it a bug fix and not caring. But, we should maybe give it a release note, since it is in the legacy (stable) random API. But others may disagree. |
Follow-up PR: #14465 |
Is this safe? Note that |
The |
@charris wrote
What code are you looking at? |
@WarrenWeckesser NVM, I was looking at the 1.16 version of the code, everything is different in 1.17. |
Fixes #14457
This caused a incorrect
int64*
pointer-dereference to anint32
array in 32-bit mode wherenpy_long
is notnpy_int64
.