diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2020-03-07 16:54:59 +0100 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2020-03-07 16:54:59 +0100 |
commit | 04f5853b42f3c886fc7a3b553e32f1d1bf21419b (patch) | |
tree | 668f217fdb9666fd2fb638c46c9a01405195606d /astroid/protocols.py | |
parent | 7120d894635662d49b05c0cc5d664b5a25544605 (diff) | |
download | astroid-git-04f5853b42f3c886fc7a3b553e32f1d1bf21419b.tar.gz |
Do not infer the first argument of a staticmethod in a metaclass as the class itself
Close PyCQA/pylint#3032
Diffstat (limited to 'astroid/protocols.py')
-rw-r--r-- | astroid/protocols.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/astroid/protocols.py b/astroid/protocols.py index 6179ab34..185bda55 100644 --- a/astroid/protocols.py +++ b/astroid/protocols.py @@ -317,9 +317,14 @@ def _arguments_infer_argname(self, name, context): if not (self.arguments or self.vararg or self.kwarg): yield util.Uninferable return + + functype = self.parent.type # first argument of instance/class method - if self.arguments and getattr(self.arguments[0], "name", None) == name: - functype = self.parent.type + if ( + self.arguments + and getattr(self.arguments[0], "name", None) == name + and functype != "staticmethod" + ): cls = self.parent.parent.scope() is_metaclass = isinstance(cls, nodes.ClassDef) and cls.type == "metaclass" # If this is a metaclass, then the first argument will always |