Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions mypy/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4057,14 +4057,14 @@ def has_readable_member(self, name: str) -> bool:

def get_method(self, name: str) -> FuncBase | Decorator | None:
for cls in self.mro:
if name in cls.names:
node = cls.names[name].node
elif possible_redefinitions := sorted(
[n for n in cls.names.keys() if n.startswith(f"{name}-redefinition")]
):
node = cls.names[possible_redefinitions[-1]].node
else:
continue
sym = cls.names.get(name)
if sym is None:
# add_redefinition installs the unnumbered name before any numbered ones.
prefix = f"{name}-redefinition"
if prefix not in cls.names:
continue
sym = cls.names[max(n for n in cls.names if n.startswith(prefix))]
node = sym.node
if isinstance(node, SYMBOL_FUNCBASE_TYPES):
return node
elif isinstance(node, Decorator): # Two `if`s make `mypyc` happy
Expand Down
Loading