New submission from Ismo Toijala <ismo.toij...@gmail.com>:
The following example should work but does not. Note that it does work without the future import. from __future__ import annotations import typing def f() -> typing.NoReturn: pass typing.get_type_hints(f) Traceback (most recent call last): File "foo.py", line 8, in <module> typing.get_type_hints(f) File "/usr/lib/python3.7/typing.py", line 1001, in get_type_hints value = _eval_type(value, globalns, localns) File "/usr/lib/python3.7/typing.py", line 260, in _eval_type return t._evaluate(globalns, localns) File "/usr/lib/python3.7/typing.py", line 466, in _evaluate is_argument=self.__forward_is_argument__) File "/usr/lib/python3.7/typing.py", line 135, in _type_check raise TypeError(f"Plain {arg} is not valid as type argument") TypeError: Plain typing.NoReturn is not valid as type argument ---------- components: Library (Lib) messages: 327274 nosy: itoijala priority: normal severity: normal status: open title: NoReturn not allowed by get_type_hints when future import annotations is used type: behavior versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34921> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com