-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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: Segfault on np.random.set_state(())
#25402
Comments
I can reproduce this. It looks like it's segfaulting inside of tuple getitem when it tries to access I'm a little surprised cython doesn't raise a ValueError instead. A quick fix would be to check for a sequence of the correct length with the types we expect. That said, this is in the legacy RNG interface. I'm not sure if we're still updating it. But we should probably avoid seg faults in the python API, even if it is a legacy API. |
Ah, another thing we could do is wrap just that one line in a @rkern would a one-line change to |
@ngoldbaum The problem is caused by the second line in
If compiled with |
Right, but this is the legacy RNG interface which we're not supposed to make major changes in. Turning on bounds checking for the whole file might be a serious performance degradation for some workflows. Turning it on for one line in the input validation is less likely to impact users. |
Yes, preventing segfaults is in-bounds (no pun intended, but appreciated after the fact). I do prefer the one-line change rather than the whole-file change for the reasons you give. |
Describe the issue:
When I call
np.random.set_state(())
(passing in a tuple()
, which is not an expected argument) I get a segfaultReproduce the code example:
Python and NumPy Versions:
The text was updated successfully, but these errors were encountered: