Skip to content

Commit

Permalink
Fix TypedDict on new Python and typing_extensions (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilevkivskyi committed Jun 19, 2022
1 parent 462c704 commit f052816
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions typing_inspect.py
Expand Up @@ -16,8 +16,13 @@
if (3, 4, 0) <= sys.version_info[:3] < (3, 9, 2):
from typing_extensions import _TypedDictMeta as _TypedDictMeta_TE
elif sys.version_info[:3] >= (3, 9, 2):
# typing_extensions.TypedDict is a re-export from typing.
from typing import _TypedDictMeta as _TypedDictMeta_TE
# Situation with typing_extensions.TypedDict is complicated.
# Use the one defined in typing_extentions, and if there is none,
# fall back to typing.
try:
from typing_extensions import _TypedDictMeta as _TypedDictMeta_TE
except ImportError:
from typing import _TypedDictMeta as _TypedDictMeta_TE
else:
# typing_extensions.TypedDict is a re-export from typing.
from typing import TypedDict
Expand Down

0 comments on commit f052816

Please sign in to comment.