summaryrefslogtreecommitdiff
path: root/pylint/checkers/classes.py
diff options
context:
space:
mode:
Diffstat (limited to 'pylint/checkers/classes.py')
-rw-r--r--pylint/checkers/classes.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/pylint/checkers/classes.py b/pylint/checkers/classes.py
index 2dc45e1..6763f74 100644
--- a/pylint/checkers/classes.py
+++ b/pylint/checkers/classes.py
@@ -723,16 +723,13 @@ a metaclass class method.'}
# b = property(lambda: self._b)
stmt = node.parent.statement()
- try:
- if (isinstance(stmt, astroid.Assign) and
- (stmt in klass.body or klass.parent_of(stmt)) and
- isinstance(stmt.value, astroid.Call) and
- isinstance(stmt.value.func, astroid.Name) and
- stmt.value.func.name == 'property' and
- is_builtin_object(next(stmt.value.func.infer(), None))):
+ if (isinstance(stmt, astroid.Assign)
+ and len(stmt.targets) == 1
+ and isinstance(stmt.targets[0], astroid.AssignName)):
+ name = stmt.targets[0].name
+ if _is_attribute_property(name, klass):
return
- except astroid.InferenceError:
- pass
+
self.add_message('protected-access', node=node, args=attrname)
def visit_name(self, node):