Skip to content

Commit fb6839a

Browse files
author
Michael Brewer
committed
fix(parser): Check python version_info for typing
Changes: - Use sys.version_info to determine where we need typing_extensions Reference: https://mypy.readthedocs.io/en/stable/runtime_troubles.html#using-new-additions-to-the-typing-module
1 parent 73e96cf commit fb6839a

File tree

1 file changed

+3
-2
lines changed
  • aws_lambda_powertools/utilities/parser

1 file changed

+3
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
"""Generics and other shared types used across parser"""
22

3+
import sys
34
from typing import TypeVar
45

56
from pydantic import BaseModel
67

78
# We only need typing_extensions for python versions <3.8
8-
try:
9+
if sys.version_info >= (3, 8):
910
from typing import Literal # noqa: F401
10-
except ImportError:
11+
else:
1112
from typing_extensions import Literal # noqa: F401
1213

1314
Model = TypeVar("Model", bound=BaseModel)

0 commit comments

Comments
 (0)