diff --git a/jedi/evaluate/finder.py b/jedi/evaluate/finder.py index 1b3153fb..5e815ec1 100644 --- a/jedi/evaluate/finder.py +++ b/jedi/evaluate/finder.py @@ -274,8 +274,9 @@ class NameFinder(object): # check for `except X as y` usages, because y needs to be instantiated. p = stmt.parent + # TODO this looks really hacky, improve parser representation! if isinstance(p, pr.Flow) and p.command == 'except' \ - and p.get_defined_names(is_internal_call=True) == [name]: + and p.inputs and p.inputs[0].as_names == [name]: # TODO check for types that are not classes and add it to the # static analysis report. types = list(chain.from_iterable( diff --git a/test/completion/basic.py b/test/completion/basic.py index b10318f1..44d8b3ea 100644 --- a/test/completion/basic.py +++ b/test/completion/basic.py @@ -342,6 +342,10 @@ try: except MyException as e: #? ['my_attr'] e.my_attr + #? 22 ['my_attr'] + for x in e.my_attr: + pass + # ----------------- # continuations