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
sydney-runkle
left a comment
There was a problem hiding this comment.
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! |
sydney-runkle
left a comment
There was a problem hiding this comment.
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.Selfintroduced in python3.11 as property annotation.Related issue number
fix #5992
Checklist
Selected Reviewer: @adriangb