summaryrefslogtreecommitdiff
path: root/astroid/protocols.py
diff options
context:
space:
mode:
authorCeridwen <ceridwenv@gmail.com>2015-11-06 17:58:34 -0500
committerCeridwen <ceridwenv@gmail.com>2015-11-06 17:58:34 -0500
commit2f88b3eb44b6e895f45dd45c709e29a8f365e04f (patch)
tree07cc8d156eb7b72caca057ef32c3de721cd2a71c /astroid/protocols.py
parent3ca0c7580187913bec11d0042a36906a2af36c91 (diff)
parent86263c86c07cb47337a2f15174844fb60ed4d2d3 (diff)
downloadastroid-git-2f88b3eb44b6e895f45dd45c709e29a8f365e04f.tar.gz
Merge upstream
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 b294a0b3..cb8426fb 100644
--- a/astroid/protocols.py
+++ b/astroid/protocols.py
@@ -280,12 +280,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)