mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 23:34:45 +08:00
fixed for loop in exception issue combined with usage of an exception variable
This commit is contained in:
@@ -274,8 +274,9 @@ class NameFinder(object):
|
|||||||
|
|
||||||
# check for `except X as y` usages, because y needs to be instantiated.
|
# check for `except X as y` usages, because y needs to be instantiated.
|
||||||
p = stmt.parent
|
p = stmt.parent
|
||||||
|
# TODO this looks really hacky, improve parser representation!
|
||||||
if isinstance(p, pr.Flow) and p.command == 'except' \
|
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
|
# TODO check for types that are not classes and add it to the
|
||||||
# static analysis report.
|
# static analysis report.
|
||||||
types = list(chain.from_iterable(
|
types = list(chain.from_iterable(
|
||||||
|
|||||||
@@ -342,6 +342,10 @@ try:
|
|||||||
except MyException as e:
|
except MyException as e:
|
||||||
#? ['my_attr']
|
#? ['my_attr']
|
||||||
e.my_attr
|
e.my_attr
|
||||||
|
#? 22 ['my_attr']
|
||||||
|
for x in e.my_attr:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# continuations
|
# continuations
|
||||||
|
|||||||
Reference in New Issue
Block a user