Message402563
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. |
|
Date |
User |
Action |
Args |
2021-09-24 13:44:07 | sobolevn | set | recipients:
+ sobolevn |
2021-09-24 13:44:07 | sobolevn | set | messageid: <1632491047.59.0.655973158516.issue45283@roundup.psfhosted.org> |
2021-09-24 13:44:07 | sobolevn | link | issue45283 messages |
2021-09-24 13:44:07 | sobolevn | create | |
|