Skip to content

Commit cfb8e54

Browse files
committed
Guard scalar arguments with API_VERSION>=2024.12
1 parent 866cedb commit cfb8e54

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Diff for: array_api_strict/_helpers.py

+9
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,20 @@
22
"""
33
import numpy as np
44

5+
from ._flags import get_array_api_strict_flags
6+
7+
58
_py_scalars = (bool, int, float, complex)
69

10+
711
def _maybe_normalize_py_scalars(x1, x2):
812
from ._array_object import Array
913

14+
flags = get_array_api_strict_flags()
15+
if flags["array_api"] < "2024.12":
16+
# XXX: string comparison for versions
17+
return x1, x2
18+
1019
if isinstance(x1, _py_scalars):
1120
if isinstance(x2, _py_scalars):
1221
raise TypeError(f"Two scalars not allowed, {type(x1) = } and {type(x2) =}")

0 commit comments

Comments
 (0)