Skip to content

Conversation

@alexfikl
Copy link
Collaborator

get_annotations only gets annotations from the current class, but not from any subclasses. This extends that by going through the MRO (in reverse) and gathering all of them up.

Context: boxtree.Tree inherits from boxtree.TreeOfBoxes and this wouldn't recognize the fields from TreeOfBoxes, which are still in the list returned by fields(Tree).

@inducer
Copy link
Owner

inducer commented Jul 31, 2025

Thanks! Added a test of sorts, plus some other coincidental typing stuff.

@inducer inducer enabled auto-merge (rebase) July 31, 2025 14:26
@inducer inducer merged commit 9ccae3a into inducer:main Jul 31, 2025
11 checks passed
@alexfikl alexfikl deleted the dataclass-subclasses branch July 31, 2025 16:37
@alexfikl
Copy link
Collaborator Author

Thanks! Added a test of sorts, plus some other coincidental typing stuff.

Thanks for adding the test!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants