diff options
Diffstat (limited to 'pylint/checkers/typecheck.py')
-rw-r--r-- | pylint/checkers/typecheck.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py index 8f26e0b4f..417662b87 100644 --- a/pylint/checkers/typecheck.py +++ b/pylint/checkers/typecheck.py @@ -1395,10 +1395,12 @@ accessed. Python regular expressions are accepted.", # Retrieve node from all previusly visited nodes in the the inference history context_path_names = filter(None, _unflatten(context.path)) inferred_paths = _flatten_container( - path.infer() for path in context_path_names + safe_infer(path) for path in context_path_names ) - for inf_path in inferred_paths: - scope = inf_path.scope() + for inferred_path in inferred_paths: + if not inferred_path: + continue + scope = inferred_path.scope() if not isinstance(scope, astroid.FunctionDef): continue if decorated_with(scope, self.config.contextmanager_decorators): |