Skip to content

Commit 5316b07

Browse files
authored
Merge pull request #88 from asmeurer/api_version
Update the api_version check to allow 2022.12 and warn on 2021.12
2 parents c757262 + 3af4f2a commit 5316b07

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

Diff for: array_api_compat/common/_helpers.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import sys
1717
import math
1818
import inspect
19+
import warnings
1920

2021
def is_numpy_array(x):
2122
# Avoid importing NumPy if it isn't already
@@ -77,8 +78,10 @@ def is_array_api_obj(x):
7778
or hasattr(x, '__array_namespace__')
7879

7980
def _check_api_version(api_version):
80-
if api_version is not None and api_version != '2021.12':
81-
raise ValueError("Only the 2021.12 version of the array API specification is currently supported")
81+
if api_version == '2021.12':
82+
warnings.warn("The 2021.12 version of the array API specification was requested but the returned namespace is actually version 2022.12")
83+
elif api_version is not None and api_version != '2022.12':
84+
raise ValueError("Only the 2022.12 version of the array API specification is currently supported")
8285

8386
def array_namespace(*xs, api_version=None, _use_compat=True):
8487
"""

0 commit comments

Comments
 (0)