forked from VimPlug/jedi
fix except: usage in analysis
This commit is contained in:
@@ -90,6 +90,10 @@ def _check_for_exception_catch(evaluator, jedi_obj, exception, payload=None):
|
|||||||
def check_try_for_except(obj):
|
def check_try_for_except(obj):
|
||||||
while obj.next is not None:
|
while obj.next is not None:
|
||||||
obj = obj.next
|
obj = obj.next
|
||||||
|
if not obj.inputs:
|
||||||
|
# No import implies a `except:` catch, which catches
|
||||||
|
# everything.
|
||||||
|
return True
|
||||||
for i in obj.inputs:
|
for i in obj.inputs:
|
||||||
except_classes = evaluator.eval_statement(i)
|
except_classes = evaluator.eval_statement(i)
|
||||||
for cls in except_classes:
|
for cls in except_classes:
|
||||||
|
|||||||
@@ -57,6 +57,15 @@ try:
|
|||||||
except Undefined:
|
except Undefined:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# -----------------
|
||||||
|
# inheritance
|
||||||
|
# -----------------
|
||||||
|
|
||||||
|
# should catch everything
|
||||||
|
try:
|
||||||
|
undefined
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# -----------------
|
# -----------------
|
||||||
# kind of similar: hasattr
|
# kind of similar: hasattr
|
||||||
|
|||||||
Reference in New Issue
Block a user