[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

2022-02-11 Thread Gregory Beauregard
Gregory Beauregard added the comment: It occurred to be that we do need to add the __call__ to KW_ONLY, but for a different reason than this bpo: If you call get_type_hints on a dataclass with a KW_ONLY parameter when PEP 563 is enabled, the entire call will fail if KW_ONLY isn't

[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

2022-01-28 Thread Gregory Beauregard
Gregory Beauregard added the comment: I had a few style, approach, and testing preference questions, but I decided they're probably best addressed in a code review so I went ahead and posted the PR. -- ___ Python tracker

[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

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

[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

2022-01-27 Thread Eric V. Smith
Eric V. Smith added the comment: I was hoping to wait until the PEP 649 / PEP 563 thing was decided. But I realize that no matter how that turns out, there will be a need to deal with string annotations. So I think I'm okay with the regex changes. Personally, I think we should remove

[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

2022-01-27 Thread Gregory Beauregard
Gregory Beauregard added the comment: Hi Eric, to follow up on https://bugs.python.org/msg411943 I'm currently a bit negative on moving to get_type_hints, even though I got it working for the test suite. I think your worries with nesting are well placed, particularly with namespaces and

[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

2022-01-25 Thread Gregory Beauregard
Gregory Beauregard added the comment: Or rather, ^\s*(?:(?:\w+\s*\.)?\s*Annotated\s*\[)?(?:\s*(\w+)\s*\.)?\s*(\w+) -- ___ Python tracker ___

[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

2022-01-25 Thread Gregory Beauregard
Gregory Beauregard added the comment: Thanks for getting back so quickly. Annotated is set up to be 'transparent' by default to `typing.get_type_hints` so in the case of using `typing.py` it can be made straightforward by chaining with `typing.get_origin`, I think. I don't see any

[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

2022-01-25 Thread Eric V. Smith
Eric V. Smith added the comment: My thoughts are that I'd like PEP 563 to go away, and PEP 649 to be accepted, and also never allow string literal annotations like the string "Annotated[ClassVar[int]]". But since we'll no doubt have to support string-ized annotations even if PEP 649 is

[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

2022-01-25 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: Related: issue44799 about InitVar. -- ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue46511] dataclasses: Allow typing.Annotated to wrap dataclasses-specific annotations

2022-01-25 Thread Gregory Beauregard
New submission from Gregory Beauregard : In https://bugs.python.org/issue46491 the typing runtime behavior was changed so that `Annotated[Classvar[...]]` is now valid at runtime in order to alleviate tension between typing and non-typing annotation space uses. dataclasses.py should likely