-
Notifications
You must be signed in to change notification settings - Fork 23
Disallow scalar conversion for non-0D arrays #2694
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
base: master
Are you sure you want to change the base?
Conversation
|
NumPy allows converting non-0D ndarrays to |
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/2694/index.html |
|
Array API standard conformance tests for dpnp=0.20.0dev1=py313h509198e_27 ran successfully. |
|
|
|
||
| def __int__(self, /): | ||
| """Convert a zero-dimensional array to a Python int object.""" | ||
| self._check_scalar_convertible() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you consider implementing that check in dpctl? Since current dpctl implementation seems breaking Python array API spec:
array.int() → int
Converts a zero-dimensional array to a Python int object.
This PR disallows converting non-0D
dpnp.ndarrayto Python scalars (int,floatandcomplex) and raisesTypeError` to align with NumPy 2.4.0