New submission from Gregory Beauregard <g...@greg.red>:

```
class C:
    a: "ClassVar"

get_type_hints(C, globals())  # TypeError: Plain typing.ClassVar is not valid 
as type argument
```

A stringified lone ClassVar raises at runtime, but this pattern is tested for 
in dataclasses unit tests and used in the wild. The PEP is not clear that it 
should or should not be used with arguments, and it works fine when not 
stringified.

The fix for this is trivial and I can submit a patch if there's agreement.

----------
components: Library (Lib)
messages: 411923
nosy: GBeauregard, Jelle Zijlstra, eric.smith, gvanrossum, kj
priority: normal
severity: normal
status: open
title: typing: get_type_hints on stringified lone ClassVar raises TypeError
versions: Python 3.10, Python 3.11, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46553>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to