summaryrefslogtreecommitdiff
path: root/astroid/protocols.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2019-11-14 11:25:42 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2019-11-14 11:25:42 +0100
commitff9424fb26c90b03ec5f6e44568833ada5dd236e (patch)
tree13124c1e1cd5eae91b364a661a5eef78dcbbebc6 /astroid/protocols.py
parent78d5537b6a40a5d4f5f80bad7ba567ff716d728a (diff)
downloadastroid-git-ff9424fb26c90b03ec5f6e44568833ada5dd236e.tar.gz
Infer args unpacking of ``self``
Certain stdlib modules use ``*args`` to encapsulate the ``self`` parameter, which results in uninferable instances given we rely on the presence of the ``self`` argument to figure out the instance where we should be setting attributes. Close PyCQA/pylint#3216
Diffstat (limited to 'astroid/protocols.py')
-rw-r--r--astroid/protocols.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/astroid/protocols.py b/astroid/protocols.py
index 8b682e48..84e3571b 100644
--- a/astroid/protocols.py
+++ b/astroid/protocols.py
@@ -339,6 +339,9 @@ def _arguments_infer_argname(self, name, context):
if name == self.vararg:
vararg = nodes.const_factory(())
vararg.parent = self
+ if not self.arguments and self.parent.name == "__init__":
+ cls = self.parent.parent.scope()
+ vararg.elts = [bases.Instance(cls)]
yield vararg
return
if name == self.kwarg: