New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for typing.Self (fix #5992) #9023
Add support for typing.Self (fix #5992) #9023
Conversation
use soft access for check
CodSpeed Performance ReportMerging #9023 will not alter performanceComparing Summary
|
please review |
no changes required to this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requested a few minor changes. Looks good overall!
@adriangb, are you ok with the stack-based implementation here?
I haven't done a deep dive, but I feel like maybe our 4 (or 5) stacks being passed around might be able to be simplified / unified somewhat...
I think we maybe need some tests that verify python inheritance behavior, not just data shape. That is, something more along the lines of your original test @Youssefares. Also some json based tests. |
I'm good with this stack based approach for now. I do think we could revisit consolidating some of the stack based logic, but that need not fit in this PR :). |
If you're able to add those extra test cases that Adrian mentioned by the end of the week, we can include this in the 2.7 release. Thanks a bunch for your help 🚀 this is looking great so far! |
Added more tests. Also realised more work is needed for use of Self inside other types referenced as properties or used with TypeAdapter. So a slight scope expansion with a couple more places to push to the stack and a few more tests. Feedback appreciated! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Thanks for adding the additional tests for the additional use cases :). This will be a much appreciated feature in 2.7!!
Change Summary
add support for
typing.Self
introduced in python3.11 as property annotation.Related issue number
fix #5992
Checklist
Selected Reviewer: @adriangb