From ebe75a0e80e538946926b491eaf7b6c9305ac627 Mon Sep 17 00:00:00 2001 From: Claudiu Popa Date: Fri, 24 Apr 2015 11:11:41 +0300 Subject: Document why _emit_no_member can't be used before the actual .getattr call. --- pylint/checkers/typecheck.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pylint/checkers/typecheck.py b/pylint/checkers/typecheck.py index 1e9b004..784ca1d 100644 --- a/pylint/checkers/typecheck.py +++ b/pylint/checkers/typecheck.py @@ -291,6 +291,13 @@ accessed. Python regular expressions are accepted.'} # XXX method / function continue except NotFoundError: + # This can't be moved before the actual .getattr call, + # because there can be more values inferred and we are + # stopping after the first one which has the attribute in question. + # The problem is that if the first one has the attribute, + # but we continue to the next values which doesn't have the + # attribute, then we'll have a false positive. + # So call this only after the call has been made. if not _emit_no_member(owner, name, node.attrname, self.config.ignored_modules, self.config.ignore_mixin_members, -- cgit v1.2.1