summaryrefslogtreecommitdiff
path: root/checkers
diff options
context:
space:
mode:
Diffstat (limited to 'checkers')
-rw-r--r--checkers/classes.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/checkers/classes.py b/checkers/classes.py
index a38f21c75..2eb49e68c 100644
--- a/checkers/classes.py
+++ b/checkers/classes.py
@@ -226,7 +226,9 @@ instance attributes.'}
# check if the method overload an attribute
try:
overridden = klass.instance_attr(node.name)[0] # XXX
- while not isinstance(overridden, astng.Class):
+ # we may be unable to get owner class if this is a monkey
+ # patched method
+ while overridden.parent and not isinstance(overridden, astng.Class):
overridden = overridden.parent.frame()
self.add_message('E0202', args=overridden.name, node=node)
except astng.NotFoundError: