diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2019-09-10 10:31:33 +0200 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2019-09-10 10:31:33 +0200 |
commit | ca54a1a87f6382c68287ebc1996312ceb921f16c (patch) | |
tree | b2f0076b8d15bc621ae15882f782aef5a3056fbb | |
parent | 6b3afd4f6d75debd7f286f0d3c760ed10ab1e79f (diff) | |
download | pylint-git-ca54a1a87f6382c68287ebc1996312ceb921f16c.tar.gz |
Do not scope the iterating contexts to builtins
This caused issues detecting that `OrderedDict` and similar non-builtin
predefined iterable consumers where not in fact in an *iterating* context.
Close #3075
-rw-r--r-- | pylint/checkers/python3.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/pylint/checkers/python3.py b/pylint/checkers/python3.py index e6bd0f38e..b8f848d4e 100644 --- a/pylint/checkers/python3.py +++ b/pylint/checkers/python3.py @@ -113,8 +113,7 @@ def _in_iterating_context(node): # value. elif isinstance(parent, astroid.Call): if isinstance(parent.func, astroid.Name): - parent_scope = parent.func.lookup(parent.func.name)[0] - if _is_builtin(parent_scope) and parent.func.name in _ACCEPTS_ITERATOR: + if parent.func.name in _ACCEPTS_ITERATOR: return True elif isinstance(parent.func, astroid.Attribute): if parent.func.attrname in ATTRIBUTES_ACCEPTS_ITERATOR: |