diff options
author | Aaron Meurer <asmeurer@gmail.com> | 2021-07-22 18:19:59 -0600 |
---|---|---|
committer | Aaron Meurer <asmeurer@gmail.com> | 2021-07-22 18:20:37 -0600 |
commit | deaf0bf6fc819c9c7b4dcffe0d4aee43bdc33bae (patch) | |
tree | 29c1a7b8d1fe39f7535960ce8df519d42c6db2d2 /numpy/_array_api/_array_object.py | |
parent | 64bb971096892c08416c5787d705a29bcd5b64b5 (diff) | |
download | numpy-deaf0bf6fc819c9c7b4dcffe0d4aee43bdc33bae.tar.gz |
Fix the array API __abs__() to restrict to numeric dtypes
Diffstat (limited to 'numpy/_array_api/_array_object.py')
-rw-r--r-- | numpy/_array_api/_array_object.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/numpy/_array_api/_array_object.py b/numpy/_array_api/_array_object.py index 98e2f78f9..cd16f49ee 100644 --- a/numpy/_array_api/_array_object.py +++ b/numpy/_array_api/_array_object.py @@ -317,6 +317,8 @@ class Array: """ Performs the operation __abs__. """ + if self.dtype not in _numeric_dtypes: + raise TypeError('Only numeric dtypes are allowed in __abs__') res = self._array.__abs__() return self.__class__._new(res) |