Kaydet (Commit) 5eea0ad5 authored tarafından Noah Wood's avatar Noah Wood Kaydeden (comit) Ivan Levkivskyi

bpo-34921: Allow escaped NoReturn in get_type_hints (GH-9750)

üst 4c339970
......@@ -130,7 +130,7 @@ def _type_check(arg, msg, is_argument=True):
if (isinstance(arg, _GenericAlias) and
arg.__origin__ in invalid_generic_forms):
raise TypeError(f"{arg} is not valid as type argument")
if (isinstance(arg, _SpecialForm) and arg is not Any or
if (isinstance(arg, _SpecialForm) and arg not in (Any, NoReturn) or
arg in (Generic, _Protocol)):
raise TypeError(f"Plain {arg} is not valid as type argument")
if isinstance(arg, (type, TypeVar, ForwardRef)):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment