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

BUG: Addition between negative <class 'int'> and np.uint64 is not possible in numpy2 #26440

Open
kounelisagis opened this issue May 15, 2024 · 1 comment
Labels

Comments

@kounelisagis
Copy link

kounelisagis commented May 15, 2024

Describe the issue:

Couldn't find something related to this on the migration docs.

Reproduce the code example:

>>> import numpy as np
>>> a = -1
>>> type(a)
<class 'int'>
>>> b = np.uint64(2)
>>> type(b)
<class 'numpy.uint64'>
>>> a += b

Error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python integer -1 out of bounds for uint64

Python and NumPy Versions:

2.0.0rc2
3.11.9 (main, Apr 19 2024, 11:43:47) [Clang 14.0.6 ]

Runtime Environment:

[{'numpy_version': '2.0.0rc2',
  'python': '3.11.9 (main, Apr 19 2024, 11:43:47) [Clang 14.0.6 ]',
  'uname': uname_result(system='Darwin', node='Agisilaoss-MBP', release='23.4.0', version='Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:25 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6030', machine='arm64')},
 {'simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'],
                      'found': ['ASIMDHP'],
                      'not_found': ['ASIMDFHM']}}]
None

Context for the issue:

Worked as of 1.26.4

@ngoldbaum
Copy link
Member

The section describing the behavior change in the migration guide is here: https://numpy.org/devdocs/numpy_2_0_migration_guide.html#changes-to-numpy-data-type-promotion. Also take a look at NEP 50.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants