Repository navigation
Conversation
JukkaL
reviewed
Oct 7, 2026
JukkaL
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the PR! I found two apparent regressions, please have have a look. First, a decorated dunder that also exists on object now recurses forever:
from typing import Any
def deco(f: Any) -> Any:
return lambda self: f(self)
class A:
@deco
def __repr__(self) -> str:
return "A"
print(repr(A()))Second, super() into a decorated override also recurses forever, but might have a different root cause (on master this generated KeyError, so the this is arguably a regression):
from typing import Any
def deco(f: Any) -> Any:
return lambda self: f(self)
class Base:
def m(self) -> int:
return 1
class Der(Base):
@deco
def m(self) -> int:
return 2
class Sub(Der):
def m(self) -> int:
return super().m() + 1
print(Sub().m())
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#767.
Decorating a method that overrides a native method crashed with
KeyError:The override now gets a native glue method that calls the decorated attribute through the Python API, as suggested in the issue. It's used for the vtable slot and for direct native calls, so calls through a
Basereference also go through the decorator. The undecorated method is still exported in the type dict under its original name, since the decorators are applied to it at runtime.