New submission from Nikita Sobolev <m...@sobolevn.me>:
This code currently does not raise any issues: ```python # contents of `ex.py` from typing import ClassVar a: ClassVar[int] = 1 def b(c: ClassVar[int]): ... ``` And then: 1. Module: `python -c 'import ex; from typing import get_type_hints; print(get_type_hints(ex))'` 2. Function argument: `python -c 'import ex; from typing import get_type_hints; print(get_type_hints(ex.b))'` It should not be allowed. Currently, the same with `from __future__ import annotations` does correctly raise `TypeError: typing.ClassVar[int] is not valid as type argument` Related: https://github.com/python/cpython/pull/28279 I will send a PR with the fix shortly. ---------- components: Library (Lib) messages: 402563 nosy: sobolevn priority: normal severity: normal status: open title: Top / function argument level ClassVar should not be allowed during `get_type_hints()` type: behavior versions: Python 3.10, Python 3.11, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45283> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com