[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-03-17 Thread Jelle Zijlstra
Change by Jelle Zijlstra : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-03-17 Thread Eric V. Smith
Eric V. Smith added the comment: Is there any reason to keep this issue open? The PR was merged. -- ___ Python tracker ___ ___

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-28 Thread Guido van Rossum
Guido van Rossum added the comment: New changeset 5445e173e76ec792358082caf660fbdc846c64b2 by Gregory Beauregard in branch 'main': bpo-46553: allow bare typing.ClassVar annotations (#30983) https://github.com/python/cpython/commit/5445e173e76ec792358082caf660fbdc846c64b2 --

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-28 Thread Gregory Beauregard
Change by Gregory Beauregard : -- keywords: +patch pull_requests: +29162 stage: -> patch review pull_request: https://github.com/python/cpython/pull/30983 ___ Python tracker

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Guido van Rossum
Guido van Rossum added the comment: I To be clear: I am okay with this patch, just not with making dataclasses import typing. -- --Guido (mobile) -- ___ Python tracker ___

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Gregory Beauregard
Gregory Beauregard added the comment: I think I miscommunicated my intent with sentence placement. I already posted the thoughts I referred to; they're just my concluding opinion on the technical merit of using get_type_hints in dataclasses to solve the Annotated problem:

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Guido van Rossum
Guido van Rossum added the comment: Please just don't go there. I beg you. It's not worth it. -- ___ Python tracker ___ ___

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Gregory Beauregard
Gregory Beauregard added the comment: It's acceptable to mypy, and pyright added support a few months ago when I made an issue and Eric Traut discovered this pattern in the wild too. Some of the other type checkers (pyre) still error I believe. My feeling is that since this has apparently

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Guido van Rossum
Guido van Rossum added the comment: It seems acceptable to mypy. I'm not sure I like the agenda of "moving dataclasses to using typing.py introspection tools". -- ___ Python tracker

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Gregory Beauregard
Gregory Beauregard added the comment: I'm drafting an implementation for the purpose of investigating performance right now; I will share when ready. -- ___ Python tracker

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Eric V. Smith
Eric V. Smith added the comment: dataclasses is no doubt too lenient. But it's just trying to accept valid strings that look like ClassVar. Way back when this was initially implemented, we decided that calling get_type_hints would be too expensive for every dataclass, and would also

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Gregory Beauregard
Change by Gregory Beauregard : -- nosy: +GBeauregard ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Gregory Beauregard
Change by Gregory Beauregard : -- type: -> behavior ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Gregory Beauregard
Change by Gregory Beauregard : -- nosy: +AlexWaygood, sobolevn -GBeauregard ___ Python tracker ___ ___ Python-bugs-list mailing

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Gregory Beauregard
Gregory Beauregard added the comment: I think this is needed for moving dataclasses to using typing.py introspection tools to be viable. -- ___ Python tracker ___

[issue46553] typing: get_type_hints on stringified lone ClassVar raises TypeError

2022-01-27 Thread Gregory Beauregard
New submission from Gregory Beauregard : ``` 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