summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <cpopa@cloudbasesolutions.com>2015-04-18 15:17:06 +0300
committerClaudiu Popa <cpopa@cloudbasesolutions.com>2015-04-18 15:17:06 +0300
commitb52c0a166e8d853b7a92c2a95cbb2c928c457f24 (patch)
tree29895db75618df9a3c3be96f10e75204cddaab0a
parent8bab7364fdbe24bb0f10a6a4147b84618e5e43e4 (diff)
downloadpylint-b52c0a166e8d853b7a92c2a95cbb2c928c457f24.tar.gz
Do a lookup in the locals when looking for __reversed__.
This patch uses a .locals lookup instead of a .getattr lookup, because we are interested only in the __reversed__ special methods defined in dict subclasses, without looking in ancestors.
-rw-r--r--pylint/checkers/base.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/pylint/checkers/base.py b/pylint/checkers/base.py
index 532ad01..e0eb551 100644
--- a/pylint/checkers/base.py
+++ b/pylint/checkers/base.py
@@ -872,8 +872,8 @@ functions, methods
# Mappings aren't accepted by reversed(), unless
# they provide explicitly a __reversed__ method.
try:
- argument.getattr(REVERSED_PROTOCOL_METHOD)
- except astroid.NotFoundError:
+ argument.locals[REVERSED_PROTOCOL_METHOD]
+ except KeyError:
self.add_message('bad-reversed-sequence', node=node)
return