Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TypedDict on new Python and typing_extensions #86

Merged
merged 1 commit into from Jun 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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