diff options
author | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-04-24 11:11:41 +0300 |
---|---|---|
committer | Claudiu Popa <cpopa@cloudbasesolutions.com> | 2015-04-24 11:11:41 +0300 |
commit | ebe75a0e80e538946926b491eaf7b6c9305ac627 (patch) | |
tree | faa75368f49db15afeb44c0d5e903ea0e9dcdb6b | |
parent | 2714f46c74bfedcb29626465a90c1c41194bc8db (diff) | |
download | pylint-ebe75a0e80e538946926b491eaf7b6c9305ac627.tar.gz |
Document why _emit_no_member can't be used before the actual .getattr call.
-rw-r--r-- | pylint/checkers/typecheck.py | 7 |
1 files changed, 7 insertions, 0 deletions
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, |