diff options
| author | Aaron Meurer <asmeurer@gmail.com> | 2021-07-16 15:02:10 -0600 |
|---|---|---|
| committer | Aaron Meurer <asmeurer@gmail.com> | 2021-07-16 15:02:10 -0600 |
| commit | d9b958259bda8db50949922770101217b2d0b50a (patch) | |
| tree | 8964fc0ac699dbe87b6b1566f0aaf263e53c9486 /numpy/_array_api/_array_object.py | |
| parent | 185d06d45cbc21ad06d7719ff265b1132d1c41ff (diff) | |
| download | numpy-d9b958259bda8db50949922770101217b2d0b50a.tar.gz | |
Move the dtype check to the array API Array._new constructor
Diffstat (limited to 'numpy/_array_api/_array_object.py')
| -rw-r--r-- | numpy/_array_api/_array_object.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/numpy/_array_api/_array_object.py b/numpy/_array_api/_array_object.py index 0659b7b05..267bd698f 100644 --- a/numpy/_array_api/_array_object.py +++ b/numpy/_array_api/_array_object.py @@ -18,7 +18,7 @@ from __future__ import annotations import operator from enum import IntEnum from ._creation_functions import asarray -from ._dtypes import _boolean_dtypes, _integer_dtypes, _floating_dtypes +from ._dtypes import _all_dtypes, _boolean_dtypes, _integer_dtypes, _floating_dtypes from typing import TYPE_CHECKING, Any, Optional, Tuple, Union if TYPE_CHECKING: @@ -61,6 +61,8 @@ class Array: xa = np.empty((), x.dtype) xa[()] = x x = xa + if x.dtype not in _all_dtypes: + raise TypeError(f"The array_api namespace does not support the dtype '{x.dtype}'") obj._array = x return obj |
