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

Gregory Beauregard report at bugs.python.org
Thu Jan 27 19:22:30 EST 2022


Gregory Beauregard <greg at greg.red> 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 such.

In that vein, I suggest we move forward with patching the existing implementation with the discussed regex restrictions. I'm not sure if you want to remove the test cases with leading spaces; it seems not too important.

While we're there I found a bug in the test suite, a missing comma that can be fixed at the same time:
https://github.com/python/cpython/blob/b1a3446f077b7d56b89f55d98dadb8018986a3e5/Lib/test/test_dataclasses.py#L3080

Do you have any other concerns before I take a stab at this?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46511>
_______________________________________


More information about the Python-bugs-list mailing list