diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2019-11-14 11:25:42 +0100 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2019-11-14 11:25:42 +0100 |
commit | ff9424fb26c90b03ec5f6e44568833ada5dd236e (patch) | |
tree | 13124c1e1cd5eae91b364a661a5eef78dcbbebc6 /astroid/protocols.py | |
parent | 78d5537b6a40a5d4f5f80bad7ba567ff716d728a (diff) | |
download | astroid-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.py | 3 |
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: |