diff --git a/parsing.py b/parsing.py index ebd15504..26aff7be 100644 --- a/parsing.py +++ b/parsing.py @@ -1391,7 +1391,7 @@ class PyFuzzyParser(object): # main scope, so just take the last statement. try: s = self.scope.statements[-1].set_next(f) - except AttributeError: + except (AttributeError, IndexError): # If set_next doesn't exist, just add it. s = self.scope.add_statement(f) else: diff --git a/test/completion/invalid.py b/test/completion/invalid.py index c0f3d20f..57b4b00d 100644 --- a/test/completion/invalid.py +++ b/test/completion/invalid.py @@ -43,3 +43,10 @@ except AttributeError finally: pass +#? ['isinstance'] +if isi +try: + except TypeError: + #? str() + "" +