diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2020-03-27 16:42:31 +0100 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2020-03-27 16:42:31 +0100 |
commit | 5d18429401d6fc955902b3c4a44e201738f6cda5 (patch) | |
tree | 12065a23f4c2ce2b197db39b96e2fc0995213ede /pylint/checkers/refactoring.py | |
parent | 5138156604b2a53a570ab12901340bc20a603221 (diff) | |
download | pylint-git-5d18429401d6fc955902b3c4a44e201738f6cda5.tar.gz |
Properly unwrap astroid.Index on Python 3.9+
Diffstat (limited to 'pylint/checkers/refactoring.py')
-rw-r--r-- | pylint/checkers/refactoring.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pylint/checkers/refactoring.py b/pylint/checkers/refactoring.py index cacb3d436..0807152f0 100644 --- a/pylint/checkers/refactoring.py +++ b/pylint/checkers/refactoring.py @@ -1331,11 +1331,13 @@ class RecommandationChecker(checkers.BaseChecker): for subscript in child.nodes_of_class(astroid.Subscript): if not isinstance(subscript.value, astroid.Name): continue - if not isinstance(subscript.slice, astroid.Index): - continue - if not isinstance(subscript.slice.value, astroid.Name): + + slice = subscript.slice + if isinstance(slice, astroid.Index): + slice = slice.value + if not isinstance(slice, astroid.Name): continue - if subscript.slice.value.name != node.target.name: + if slice.name != node.target.name: continue if iterating_object.name != subscript.value.name: continue |