Skip to content

Commit 3730fc0

Browse files
committed
Give a better error when numpy.array_api is imported in Python 3.7
1 parent 310929d commit 3730fc0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

numpy/array_api/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@
115115
116116
"""
117117

118+
import sys
119+
# numpy.array_api is 3.8+ because it makes extensive use of positional-only
120+
# arguments.
121+
if sys.version_info < (3, 8):
122+
raise ImportError("The numpy.array_api submodule requires Python 3.8 or greater.")
123+
118124
import warnings
119125
warnings.warn("The numpy.array_api submodule is still experimental. See NEP 47.",
120126
stacklevel=2)

0 commit comments

Comments
 (0)