diff options
Diffstat (limited to 'numpy/typing/_shape.py')
-rw-r--r-- | numpy/typing/_shape.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/numpy/typing/_shape.py b/numpy/typing/_shape.py index b720c3ffc..0742be8a9 100644 --- a/numpy/typing/_shape.py +++ b/numpy/typing/_shape.py @@ -1,13 +1,14 @@ import sys from typing import Sequence, Tuple, Union +from . import _HAS_TYPING_EXTENSIONS + if sys.version_info >= (3, 8): from typing import SupportsIndex +elif _HAS_TYPING_EXTENSIONS: + from typing_extensions import SupportsIndex else: - try: - from typing_extensions import SupportsIndex - except ImportError: - SupportsIndex = NotImplemented + SupportsIndex = NotImplemented _Shape = Tuple[int, ...] |