This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author sobolevn
Recipients sobolevn
Date 2021-09-24.13:44:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1632491047.59.0.655973158516.issue45283@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-09-24 13:44:07sobolevnsetrecipients: + sobolevn
2021-09-24 13:44:07sobolevnsetmessageid: <1632491047.59.0.655973158516.issue45283@roundup.psfhosted.org>
2021-09-24 13:44:07sobolevnlinkissue45283 messages
2021-09-24 13:44:07sobolevncreate