diff options
Diffstat (limited to 'numpy/_array_api')
-rw-r--r-- | numpy/_array_api/_array_object.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/numpy/_array_api/_array_object.py b/numpy/_array_api/_array_object.py index e9ea6ef45..371361de9 100644 --- a/numpy/_array_api/_array_object.py +++ b/numpy/_array_api/_array_object.py @@ -54,8 +54,10 @@ class ndarray: obj = super().__new__(cls) # Note: The spec does not have array scalars, only shape () arrays. if isinstance(x, np.generic): - # x[...] converts an array scalar to a shape () array. - x = x[...] + # Convert the array scalar to a shape () array + xa = np.empty((), x.dtype) + xa[()] = x + x = xa obj._array = x return obj |