Repository navigation
Conversation
Collaborator
|
Note that #22157 was merged -- do you want to update this PR before merging? |
rheard
force-pushed
the
fix-mypyc-1244
branch
from
October 15, 2026 03:27
bfd243f to
12d3894
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#1244.
mypyc crashed when a method of a native class overrode a decorated method and the native signatures differed, for example when the override narrows the return type, or when both methods are
async defwith the same annotations:The function below the decorator is stored in
ClassIR.methods, socompute_vtable()gave it a vtable entry.specialize_parent_vtable()then treated an override with a different signature like an override of a native method and looked up a glue method. There is none: a decorated method isn't inmethod_decls, sohandle_ext_method()doesn't generate glue for overrides of it.A decorated method doesn't need a vtable entry at all. It isn't declared as a native method, so compiled code only calls it through the Python API. Since #22157 that also holds for a property with another decorator.
compute_vtable()now skips methods without a declaration. This generalizes the check added in #22121, which skipped only the undecorated function of a decorated override.The only other code that used those entries was the
__del__lookup ingenerate_class(). It now usesClassIR.get_method(), so a decorated__del__still gets a finalizer, and still runs through the decorator.