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

tensor.asarray raises unexpected TypeError for out of bound inputs #1512

Closed
oleksandr-pavlyk opened this issue Jan 26, 2024 · 1 comment · Fixed by #1513
Closed

tensor.asarray raises unexpected TypeError for out of bound inputs #1512

oleksandr-pavlyk opened this issue Jan 26, 2024 · 1 comment · Fixed by #1513
Assignees

Comments

@oleksandr-pavlyk
Copy link
Collaborator

dpt.asarray(-9223372036854775809, dtype=dpt.uint8)
# raises TypeError: Numpy array of data type object is not supported. Please convert the input to an array with numeric data type.

Array API test suite expected OverflowError:

np.asarray(-9223372036854775809, dtype=dpt.uint8)
# raises OverflowError: Python int too large to convert to C long

This discrepancy is behind Array API test suite failure of test_int_to_dtype.

@oleksandr-pavlyk oleksandr-pavlyk self-assigned this Jan 26, 2024
@oleksandr-pavlyk
Copy link
Collaborator Author

@ndgrigorian

ndgrigorian added a commit that referenced this issue Jan 26, 2024
dtype is passed to np.asarray when dpt.asarray is called with a Python scalar as input

This guarantees the expected OverflowError is thrown
ndgrigorian added a commit that referenced this issue Jan 27, 2024
dtype is passed to np.asarray when dpt.asarray is called with a Python scalar as input

This guarantees the expected OverflowError is thrown
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 a pull request may close this issue.

1 participant