diff options
author | Aaron Meurer <asmeurer@gmail.com> | 2021-04-13 17:05:44 -0600 |
---|---|---|
committer | Aaron Meurer <asmeurer@gmail.com> | 2021-04-13 17:05:44 -0600 |
commit | b75a135751e4b38f144027678d1ddc74ee4d50fc (patch) | |
tree | d4054d1afb3dbe8a8e73ce523ad9c7a41817d019 /numpy/_array_api/_creation_functions.py | |
parent | fb5c69775f516f06fcf6e79e0762f09e6e8cb907 (diff) | |
download | numpy-b75a135751e4b38f144027678d1ddc74ee4d50fc.tar.gz |
Fix int bounds checking in asarray() to only happen when dtype=None
Diffstat (limited to 'numpy/_array_api/_creation_functions.py')
-rw-r--r-- | numpy/_array_api/_creation_functions.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/_array_api/_creation_functions.py b/numpy/_array_api/_creation_functions.py index 107f3c313..003b10afb 100644 --- a/numpy/_array_api/_creation_functions.py +++ b/numpy/_array_api/_creation_functions.py @@ -26,7 +26,7 @@ def asarray(obj: Union[float, NestedSequence[bool|int|float], SupportsDLPack, Su raise NotImplementedError("The copy keyword argument to asarray is not yet implemented") if isinstance(obj, ndarray) and (dtype is None or obj.dtype == dtype): return obj - if isinstance(obj, int) and (obj > 2**64 or obj < -2**63): + if dtype is None and isinstance(obj, int) and (obj > 2**64 or obj < -2**63): # Give a better error message in this case. NumPy would convert this # to an object array. raise OverflowError("Integer out of bounds for array dtypes") |