From c51249ad4582a362a5ffe0da125020473fbbc556 Mon Sep 17 00:00:00 2001
From: Aaron Meurer <asmeurer@gmail.com>
Date: Thu, 8 Feb 2024 17:23:20 -0700
Subject: [PATCH 1/2] Update the api_version check to allow 2022.12 and warn on
 2021.12

Not sure if a warning is the best option here. The returned namespace is
2022.12 compliant, and that is also 2021.12 compliant (except for a few minor
things). I don't think it's worth trying to support both, unless someone has a
real use-case.
---
 array_api_compat/common/_helpers.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/array_api_compat/common/_helpers.py b/array_api_compat/common/_helpers.py
index 5e59c7ea..8a9500b6 100644
--- a/array_api_compat/common/_helpers.py
+++ b/array_api_compat/common/_helpers.py
@@ -16,6 +16,7 @@
 import sys
 import math
 import inspect
+import warnings
 
 def is_numpy_array(x):
     # Avoid importing NumPy if it isn't already
@@ -77,8 +78,10 @@ def is_array_api_obj(x):
         or hasattr(x, '__array_namespace__')
 
 def _check_api_version(api_version):
-    if api_version is not None and api_version != '2021.12':
-        raise ValueError("Only the 2021.12 version of the array API specification is currently supported")
+    if api_version == '2021.12':
+        warnings.warn("The 2021.12 version of the array API specification was requested but the returned namespace is actually version 2022.12")
+    if api_version is not None and api_version != '2022.12':
+        raise ValueError("Only the 2022.12 version of the array API specification is currently supported")
 
 def array_namespace(*xs, api_version=None, _use_compat=True):
     """

From 3af4f2a19b803815f126e523eb5fce22c7370776 Mon Sep 17 00:00:00 2001
From: Aaron Meurer <asmeurer@gmail.com>
Date: Tue, 27 Feb 2024 16:01:50 -0700
Subject: [PATCH 2/2] Fix version check logic

---
 array_api_compat/common/_helpers.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/array_api_compat/common/_helpers.py b/array_api_compat/common/_helpers.py
index 8a9500b6..e5e80f8e 100644
--- a/array_api_compat/common/_helpers.py
+++ b/array_api_compat/common/_helpers.py
@@ -80,7 +80,7 @@ def is_array_api_obj(x):
 def _check_api_version(api_version):
     if api_version == '2021.12':
         warnings.warn("The 2021.12 version of the array API specification was requested but the returned namespace is actually version 2022.12")
-    if api_version is not None and api_version != '2022.12':
+    elif api_version is not None and api_version != '2022.12':
         raise ValueError("Only the 2022.12 version of the array API specification is currently supported")
 
 def array_namespace(*xs, api_version=None, _use_compat=True):