Fix some decoding of subsubtypes in general and std::Object in particular#938
Merged
Fix some decoding of subsubtypes in general and std::Object in particular#938
Conversation
…ular I ran into a few things here: - The object.pyx code to handle decoding to subclasses only looks at __subclasses__, and so misses grandchildren types. I clearly remember thinking about this and testing the grandchild case, but apparently I missed something there. - Descendants of std::Object in particular get immediately screwy, because user-facing types don't inherit from std::Object directly, but instead their __shapes__ do. - The new "`tname__` in `__shapes__`" mechanism (#926) was putting wrong stuff in the map in some cases. My approach is to explicitly indicate which classes should be considered the canonical decoding classes with a `__gel_is_canonical__ = True` field on the class. And for now, I'm populating it explicitly, though we can probably write a bunch of nasty logic to figure it out too.
elprans
approved these changes
Sep 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I ran into a few things here:
at
__subclasses__, and so misses grandchildren types. I clearlyremember thinking about this and testing the grandchild case,
but apparently I missed something there.
because user-facing types don't inherit from std::Object directly,
but instead their
__shapes__do.tname__in__shapes__" mechanism (Move tname__ to base_shapes to reduce noise in interface classes. #926) was puttingwrong stuff in the map in some cases.
My approach is to explicitly indicate which classes should be
considered the canonical decoding classes with a
__gel_is_canonical__ = Truefield on the class. And for now, I'm populating it explicitly,though we can probably write a bunch of nasty logic to figure it out too.