summaryrefslogtreecommitdiff
path: root/astroid/protocols.py
diff options
context:
space:
mode:
authorCeridwen <ceridwenv@gmail.com>2015-11-06 18:16:41 -0500
committerCeridwen <ceridwenv@gmail.com>2015-11-06 18:16:41 -0500
commitd052e7e223d32c7afbe8d8a19ff3747025f59982 (patch)
treed336c42ff5f55840a4703ce6c2f3c133a7e8a34c /astroid/protocols.py
parentd3d9bcbc91dfb60ee88b1a6667db92fd00172d67 (diff)
parent2f88b3eb44b6e895f45dd45c709e29a8f365e04f (diff)
downloadastroid-git-d052e7e223d32c7afbe8d8a19ff3747025f59982.tar.gz
Merge upstream changes
Diffstat (limited to 'astroid/protocols.py')
-rw-r--r--astroid/protocols.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/astroid/protocols.py b/astroid/protocols.py
index 6b6c0c0f..41eeb85e 100644
--- a/astroid/protocols.py
+++ b/astroid/protocols.py
@@ -283,12 +283,16 @@ def _arguments_infer_argname(self, name, context):
# first argument of instance/class method
if self.args and getattr(self.args[0], 'name', None) == name:
functype = self.parent.type
+ 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
+ # be the class, not an instance.
+ if is_metaclass or functype == 'classmethod':
+ yield cls
+ return
if functype == 'method':
yield bases.Instance(self.parent.parent.frame())
return
- if functype == 'classmethod':
- yield self.parent.parent.frame()
- return
if context and context.callcontext:
call_site = arguments.CallSite(context.callcontext)