diff --git a/jedi/evaluate/analysis.py b/jedi/evaluate/analysis.py index ebbd4b5a..368ef85f 100644 --- a/jedi/evaluate/analysis.py +++ b/jedi/evaluate/analysis.py @@ -90,6 +90,10 @@ def _check_for_exception_catch(evaluator, jedi_obj, exception, payload=None): def check_try_for_except(obj): while obj.next is not None: obj = obj.next + if not obj.inputs: + # No import implies a `except:` catch, which catches + # everything. + return True for i in obj.inputs: except_classes = evaluator.eval_statement(i) for cls in except_classes: diff --git a/test/static_analysis/try_except.py b/test/static_analysis/try_except.py index e7198da0..48c56d53 100644 --- a/test/static_analysis/try_except.py +++ b/test/static_analysis/try_except.py @@ -57,6 +57,15 @@ try: except Undefined: pass +# ----------------- +# inheritance +# ----------------- + +# should catch everything +try: + undefined +except: + pass # ----------------- # kind of similar: hasattr