diff --git a/mode/python.py b/mode/python.py index 01f04db..59993dd 100644 --- a/mode/python.py +++ b/mode/python.py @@ -440,7 +440,7 @@ class PythonContext(context.Context): i += 1 if last is not None and y2 < len(self.namelines): - if self.namelines[y2][0]: + if self.namelines[y2] and self.namelines[y2][0]: n = len(self.namelines[y2][0].split('.')) curr = '.'.join([x[1] for x in stack[:n]]) if curr: