Skip to content
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

enable numpy 2 #1093

Merged
merged 3 commits into from
Nov 18, 2024
Merged

Conversation

Simsalabim1234
Copy link

No description provided.

@danielhrisca
Copy link
Owner

My biggest concern with numpy 2.0 is the new Python integer handling that can cause problems

>>> import numpy as np
>>> np.arange(4, dtype='u1') * (-5)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python integer -5 out of bounds for uint8
>>> np.arange(4, dtype='u1') * 1247
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python integer 1247 out of bounds for uint8

@Simsalabim1234
Copy link
Author

My biggest concern with numpy 2.0 is the new Python integer handling that can cause problems

>>> import numpy as np
>>> np.arange(4, dtype='u1') * (-5)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python integer -5 out of bounds for uint8
>>> np.arange(4, dtype='u1') * 1247
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python integer 1247 out of bounds for uint8

Hmm.. I don't have an overview over the codebase, but to me this does not look like a hard blocker, but more like an opportunity to introduce some checks and explicit casts to make the code more stable.

@danielhrisca danielhrisca merged commit 7520a66 into danielhrisca:development Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants