Repository navigation
Conversation
rheard
force-pushed
the
fix-mypyc-1241
branch
from
October 10, 2026 13:36
5e7f73e to
edeaa5e
Compare
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.
Fixes mypyc/mypyc#1241
del obj.attranddelattr()go throughtp_setattro. The wrapper for that slot was only generated for a class that defines__setattr__, and it calls__delattr__only if that class has one. A subclass that defines__delattr__and inherits__setattr__also inherited the wrapper, so its__delattr__was never called:Now a class that defines
__delattr__and inherits__setattr__from a native class gets a wrapper of its own, which calls its__delattr__and the inherited__setattr__.tp_setattrois filled for every class that has a wrapper, so the slot table is keyed on the wrapper instead of on__setattr__.The errors for
__setattr__in a class that allows interpreted subclasses or inherits from a non-native class are still reported only where__setattr__is defined.A native class that inherits
__setattr__from a non-native class doesn't get a wrapper. The slot it inherits from the non-native class looks up both methods at runtime, so that case already worked.