diff options
Diffstat (limited to 'numpy/_array_api/_manipulation_functions.py')
-rw-r--r-- | numpy/_array_api/_manipulation_functions.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/_array_api/_manipulation_functions.py b/numpy/_array_api/_manipulation_functions.py index 6308bfc26..fa6344beb 100644 --- a/numpy/_array_api/_manipulation_functions.py +++ b/numpy/_array_api/_manipulation_functions.py @@ -1,6 +1,7 @@ from __future__ import annotations from ._array_object import Array +from ._data_type_functions import result_type from typing import List, Optional, Tuple, Union @@ -14,6 +15,8 @@ def concat(arrays: Union[Tuple[Array, ...], List[Array]], /, *, axis: Optional[i See its docstring for more information. """ arrays = tuple(a._array for a in arrays) + # Call result type here just to raise on disallowed type combinations + result_type(*arrays) return Array._new(np.concatenate(arrays, axis=axis)) def expand_dims(x: Array, /, *, axis: int) -> Array: @@ -63,4 +66,6 @@ def stack(arrays: Union[Tuple[Array, ...], List[Array]], /, *, axis: int = 0) -> See its docstring for more information. """ arrays = tuple(a._array for a in arrays) + # Call result type here just to raise on disallowed type combinations + result_type(*arrays) return Array._new(np.stack(arrays, axis=axis)) |