diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2018-06-01 16:27:27 +0800 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2018-06-01 16:27:27 +0800 |
commit | 4a9e0913acf8bbc1d7796b5ea35ef6ceea867f54 (patch) | |
tree | 2b45c9e46115b6b03b70b3b59d531c2767284942 | |
parent | 20acde44c19422222ea1e00f5b3fa0de2c6e83d1 (diff) | |
download | pylint-git-4a9e0913acf8bbc1d7796b5ea35ef6ceea867f54.tar.gz |
Don't use scope() to check if the variable is defined in the current statement
This works on Python 3 because scope() for a ListComp will always be the ListComp,
but on Python 2 that's going to be the outer scope/frame instead.
Close #2106
-rw-r--r-- | pylint/checkers/python3.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pylint/checkers/python3.py b/pylint/checkers/python3.py index 7c7f5c896..76d2750e9 100644 --- a/pylint/checkers/python3.py +++ b/pylint/checkers/python3.py @@ -656,7 +656,7 @@ class Python3Checker(checkers.BaseChecker): if (scope_name.name not in names or scope_name.lineno <= node.lineno or scope_name.name in emitted_for_names - or scope_name.scope() == node): + or scope_name.statement().parent_of(node)): continue emitted_for_names.add(scope_name.name) |