gh-82129: Provide __annotate__ method for dataclasses from make_dataclass#122262
gh-82129: Provide __annotate__ method for dataclasses from make_dataclass#122262sobolevn wants to merge 10 commits into
__annotate__ method for dataclasses from make_dataclass#122262Conversation
…ake_dataclass`
|
Test failure: is expected, I just don't want to touch tests at this point. |
Sorry, something went wrong.
__annotate__ method for dataclasses from make_dataclass|
I mentioned it on the issue but with this change If you want to avoid the typing import this way you need to put some placeholder for This doesn't happen on the 3.13 version proposed because dataclasses doesn't evaluate the strings so the import doesn't get called by dataclasses when it looks at the annotations. |
Sorry, something went wrong.
|
You might be able to get around @DavidCEllis's point by adding some internal-only flag to tell |
Sorry, something went wrong.
|
Perhaps you can take advantage of If it's called with |
Sorry, something went wrong.
Yes, this is my go-to idea right now :) |
Sorry, something went wrong.
|
This PR still does not account for the problem mentioned by @DavidCEllis I will try to work around this problem. |
Sorry, something went wrong.
|
But, since cc @JelleZijlstra about my question in #122285 |
Sorry, something went wrong.
|
Now Thanks everyone for your help and ideas! 🤝 |
Sorry, something went wrong.
carljm
left a comment
There was a problem hiding this comment.
This looks reasonable to me.
Sorry, something went wrong.
…wt3u.rst Co-authored-by: Carl Meyer <carl@oddbird.net>
|
I realized there's now new way to convert annotations to source. Fixing! |
Sorry, something went wrong.
This is my plan for python3.14+
While #122232 can be backported to older versions and solve their problems, this one is actually a correct way to solve this problem for the future.
This is a WIP, because I think that we should first decide on #122232