From 12970f80aed8e488218757ac8e187d86effd50cc Mon Sep 17 00:00:00 2001 From: David Halter Date: Thu, 12 Jul 2012 12:01:28 +0200 Subject: [PATCH] fixed an index problem with the parser, which could happen with really special code --- parsing.py | 2 +- test/completion/invalid.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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() + "" +