Skip to content

Commit bdc1678

Browse files
author
Guido van Rossum
committed
Don't crash in get_method() if self.mro is None -- might be because of a previous error. Fixes #1327.
@JukkaL: This is a band-aid; it's possible that a better solution exists, e.g. marking such errors fatal, or constructing a better dummy object. But this prevents the immediate crash at hand, so we can move on to more important issues.
1 parent dda38dc commit bdc1678

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

mypy/nodes.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,6 +1590,8 @@ def get_var_or_setter(self, name: str) -> SymbolNode:
15901590
return self.get_var(name)
15911591

15921592
def get_method(self, name: str) -> FuncBase:
1593+
if self.mro is None: # Might be because of a previous error.
1594+
return None
15931595
for cls in self.mro:
15941596
if name in cls.names:
15951597
node = cls.names[name].node

0 commit comments

Comments
 (0)