Message 411923 - Python tracker

Message411923

Author GBeauregard
Recipients GBeauregard, JelleZijlstra, eric.smith, gvanrossum, kj
Date 2022-01-27.20:50:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1643316613.99.0.345169624659.issue46553@roundup.psfhosted.org>
In-reply-to
Content
```
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.
History
Date User Action Args
2022-01-27 20:50:14GBeauregardsetrecipients: + GBeauregard, gvanrossum, eric.smith, JelleZijlstra, kj
2022-01-27 20:50:13GBeauregardsetmessageid: <1643316613.99.0.345169624659.issue46553@roundup.psfhosted.org>
2022-01-27 20:50:13GBeauregardlinkissue46553 messages
2022-01-27 20:50:13GBeauregardcreate