summaryrefslogtreecommitdiff
path: root/numpy/typing/_shape.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/typing/_shape.py')
-rw-r--r--numpy/typing/_shape.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/numpy/typing/_shape.py b/numpy/typing/_shape.py
index 4629046ea..b720c3ffc 100644
--- a/numpy/typing/_shape.py
+++ b/numpy/typing/_shape.py
@@ -1,6 +1,15 @@
+import sys
from typing import Sequence, Tuple, Union
+if sys.version_info >= (3, 8):
+ from typing import SupportsIndex
+else:
+ try:
+ from typing_extensions import SupportsIndex
+ except ImportError:
+ SupportsIndex = NotImplemented
+
_Shape = Tuple[int, ...]
# Anything that can be coerced to a shape tuple
-_ShapeLike = Union[int, Sequence[int]]
+_ShapeLike = Union[SupportsIndex, Sequence[SupportsIndex]]