summaryrefslogtreecommitdiffstats
path: root/Lib/typing.py
diff options
context:
space:
mode:
authorGregory Beauregard <greg@greg.red>2022-02-07 16:21:56 (GMT)
committerGitHub <noreply@github.com>2022-02-07 16:21:56 (GMT)
commite2eeffefed32bb8c47c09bdd94e27a4e949894ef (patch)
tree8ba59ca23812faddd3097782ac10e42a1b3ecc12 /Lib/typing.py
parentc1ff4cb98b11c00aee765019364544c71e7dd2df (diff)
downloadcpython-e2eeffefed32bb8c47c09bdd94e27a4e949894ef.zip
cpython-e2eeffefed32bb8c47c09bdd94e27a4e949894ef.tar.gz
cpython-e2eeffefed32bb8c47c09bdd94e27a4e949894ef.tar.bz2
[3.10] bpo-46655: allow stringized TypeAlias with get_type_hints (GH-31156). (#31175)
(cherry picked from commit 77b025be4a4cd5a3bfc1b1af560cc57e8e956c98) Co-authored-by: Gregory Beauregard <greg@greg.red>
Diffstat (limited to 'Lib/typing.py')
-rw-r--r--Lib/typing.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/typing.py b/Lib/typing.py
index abd5899..7743c7f 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -165,7 +165,7 @@ def _type_check(arg, msg, is_argument=True, module=None, *, allow_special_forms=
if (isinstance(arg, _GenericAlias) and
arg.__origin__ in invalid_generic_forms):
raise TypeError(f"{arg} is not valid as type argument")
- if arg in (Any, NoReturn, Final):
+ if arg in (Any, NoReturn, Final, TypeAlias):
return arg
if isinstance(arg, _SpecialForm) or arg in (Generic, Protocol):
raise TypeError(f"Plain {arg} is not valid as type argument")