diff options
author | Ceridwen <ceridwenv@gmail.com> | 2015-11-06 18:16:41 -0500 |
---|---|---|
committer | Ceridwen <ceridwenv@gmail.com> | 2015-11-06 18:16:41 -0500 |
commit | d052e7e223d32c7afbe8d8a19ff3747025f59982 (patch) | |
tree | d336c42ff5f55840a4703ce6c2f3c133a7e8a34c /astroid/arguments.py | |
parent | d3d9bcbc91dfb60ee88b1a6667db92fd00172d67 (diff) | |
parent | 2f88b3eb44b6e895f45dd45c709e29a8f365e04f (diff) | |
download | astroid-git-d052e7e223d32c7afbe8d8a19ff3747025f59982.tar.gz |
Merge upstream changes
Diffstat (limited to 'astroid/arguments.py')
-rw-r--r-- | astroid/arguments.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/astroid/arguments.py b/astroid/arguments.py index 7136834c..949783af 100644 --- a/astroid/arguments.py +++ b/astroid/arguments.py @@ -196,6 +196,16 @@ class CallSite(object): else: # XXX can do better ? boundnode = funcnode.parent.frame() + + if isinstance(boundnode, nodes.ClassDef): + # Verify that we're accessing a method + # of the metaclass through a class, as in + # `cls.metaclass_method`. In this case, the + # first argument is always the class. + method_scope = funcnode.parent.scope() + if method_scope is boundnode.metaclass(): + return iter((boundnode, )) + if funcnode.type == 'method': if not isinstance(boundnode, bases.Instance): boundnode = bases.Instance(boundnode) @@ -222,7 +232,7 @@ class CallSite(object): "to {func!r}: {unpacked_kwargs!r} doesn't correspond to " "{keyword_arguments!r}.", keyword_arguments=self.keyword_arguments, - unpacked_kwargs = self._unpacked_kwargs, + unpacked_kwargs=self._unpacked_kwargs, call_site=self, func=funcnode, arg=name, context=context) kwarg = nodes.Dict(lineno=funcnode.args.lineno, col_offset=funcnode.args.col_offset, |