diff options
author | Noah Wood <26890744+JohnnyHobo@users.noreply.github.com> | 2018-10-08 18:50:16 (GMT) |
---|---|---|
committer | Ivan Levkivskyi <levkivskyi@gmail.com> | 2018-10-08 18:50:16 (GMT) |
commit | 5eea0ad50c32d38909ff4e29309e2cc3c6ccb2c0 (patch) | |
tree | 45bb8a1412e5ea1885e134ad0d3ff328057aaebe /Lib/typing.py | |
parent | 4c339970570d07916bee6ade51f4e9781d51627a (diff) | |
download | cpython-5eea0ad50c32d38909ff4e29309e2cc3c6ccb2c0.zip cpython-5eea0ad50c32d38909ff4e29309e2cc3c6ccb2c0.tar.gz cpython-5eea0ad50c32d38909ff4e29309e2cc3c6ccb2c0.tar.bz2 |
bpo-34921: Allow escaped NoReturn in get_type_hints (GH-9750)
Diffstat (limited to 'Lib/typing.py')
-rw-r--r-- | Lib/typing.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/typing.py b/Lib/typing.py index 445a424..cfcbb3b 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -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)): |