Move tname__ to base_shapes to reduce noise in interface classes.#926
Merged
Move tname__ to base_shapes to reduce noise in interface classes.#926
Conversation
3be48e8 to
77533e4
Compare
4a55950 to
4a150dc
Compare
4a150dc to
229dc88
Compare
msullivan
approved these changes
Sep 25, 2025
| # which are the ones that directly declare 'tname__' | ||
| (tname := getattr(reflection, "name", None)) is not None | ||
| and 'tname__' in namespace | ||
| and any('tname__' in base.__dict__ for base in bases) |
Member
There was a problem hiding this comment.
Sigh I guess this is fine.
Also update the comment above this, which is now wrong.
Add that tname__ isn't in namespace itself, then, I think?
Since the base shape also has base shape children, and we don't want those to get picked up.
(I don't know if it would be a bug for them to get picked up here, since they'd be correctly overwritten by their defined-later real children, but still.)
7c202e1 to
c3b2c18
Compare
c3b2c18 to
a491ea4
Compare
msullivan
added a commit
that referenced
this pull request
Sep 29, 2025
…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.
msullivan
added a commit
that referenced
this pull request
Sep 30, 2025
…ular (#938) 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.
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.
followup to #918
tname__was added to the user facing types. For example, inmodels.orm.default:This PR would moves
tname__tobase_shapes.User.