diff options
author | Aaron Meurer <asmeurer@gmail.com> | 2021-03-02 16:03:56 -0700 |
---|---|---|
committer | Aaron Meurer <asmeurer@gmail.com> | 2021-03-02 16:03:56 -0700 |
commit | d40985cbb50aeadf276a1a9332e455ddc096e113 (patch) | |
tree | 02b07d40730b7efa489079b7d8ac7b44330b10d5 /numpy/_array_api/_array_object.py | |
parent | 16030e4e6931b81997b6c2d8d0ef4f15e39b6057 (diff) | |
download | numpy-d40985cbb50aeadf276a1a9332e455ddc096e113.tar.gz |
Fix some dunder methods on that should not be converting things to arrays
Diffstat (limited to 'numpy/_array_api/_array_object.py')
-rw-r--r-- | numpy/_array_api/_array_object.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/numpy/_array_api/_array_object.py b/numpy/_array_api/_array_object.py index 4c4abeb4a..23f8ab333 100644 --- a/numpy/_array_api/_array_object.py +++ b/numpy/_array_api/_array_object.py @@ -84,7 +84,7 @@ class ndarray: Performs the operation __bool__. """ res = x._array.__bool__() - return x.__class__._new(res) + return res def __dlpack__(x: array, /, *, stream: Optional[int] = None) -> PyCapsule: """ @@ -112,7 +112,7 @@ class ndarray: Performs the operation __float__. """ res = x._array.__float__() - return x.__class__._new(res) + return res def __floordiv__(x1: array, x2: array, /) -> array: """ @@ -132,7 +132,7 @@ class ndarray: """ Performs the operation __getitem__. """ - res = x._array.__getitem__(asarray(key)._array) + res = x._array.__getitem__(key) return x.__class__._new(res) def __gt__(x1: array, x2: array, /) -> array: @@ -147,7 +147,7 @@ class ndarray: Performs the operation __int__. """ res = x._array.__int__() - return x.__class__._new(res) + return res def __invert__(x: array, /) -> array: """ @@ -251,7 +251,7 @@ class ndarray: """ Performs the operation __setitem__. """ - res = x._array.__setitem__(asarray(key)._array, asarray(value)._array) + res = x._array.__setitem__(key, asarray(value)._array) return x.__class__._new(res) def __sub__(x1: array, x2: array, /) -> array: |