We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 729175f commit b2e3eccCopy full SHA for b2e3ecc
array_api_strict/_utility_functions.py
@@ -2,6 +2,7 @@
2
3
from ._array_object import Array
4
from ._flags import requires_api_version
5
+from ._dtypes import _numeric_dtypes
6
7
from typing import TYPE_CHECKING
8
if TYPE_CHECKING:
@@ -49,6 +50,12 @@ def diff(
49
50
prepend: Optional[Array] = None,
51
append: Optional[Array] = None,
52
) -> Array:
53
+ if x.dtype not in _numeric_dtypes:
54
+ raise TypeError("Only numeric dtypes are allowed in diff")
55
+
56
+ # TODO: The type promotion behavior for prepend and append is not
57
+ # currently specified.
58
59
# NumPy does not support prepend=None or append=None
60
kwargs = dict(axis=axis, n=n)
61
if prepend is not None:
0 commit comments