Skip to content

Commit 5eea0ad

Browse files
NoahGWoodilevkivskyi
authored andcommitted
bpo-34921: Allow escaped NoReturn in get_type_hints (GH-9750)
1 parent 4c33997 commit 5eea0ad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Lib/typing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def _type_check(arg, msg, is_argument=True):
130130
if (isinstance(arg, _GenericAlias) and
131131
arg.__origin__ in invalid_generic_forms):
132132
raise TypeError(f"{arg} is not valid as type argument")
133-
if (isinstance(arg, _SpecialForm) and arg is not Any or
133+
if (isinstance(arg, _SpecialForm) and arg not in (Any, NoReturn) or
134134
arg in (Generic, _Protocol)):
135135
raise TypeError(f"Plain {arg} is not valid as type argument")
136136
if isinstance(arg, (type, TypeVar, ForwardRef)):

0 commit comments

Comments
 (0)