summaryrefslogtreecommitdiff
path: root/astroid/protocols.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2019-11-17 10:46:45 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2019-11-17 10:46:45 +0100
commitb55fc8d9731e3527ab9c4c34488a6471d0aca62f (patch)
tree6b721d04f9e819e5bfd9abca6e838e2105c8b80e /astroid/protocols.py
parent060fc2fd30dbcf8b59b8fa7d37fd9a9311af0572 (diff)
downloadastroid-git-b55fc8d9731e3527ab9c4c34488a6471d0aca62f.tar.gz
Add support for inferring exception instances in all contexts
We were able to infer exception instances as ``ExceptionInstance`` only for a handful of cases, but not all. ``ExceptionInstance`` has support for better inference of `.args` and other exception related attributes that normal instances do not have. This additional support should remove certain false positives related to ``.args`` and other exception attributes in ``pylint``. Close PyCQA/pylint#2333
Diffstat (limited to 'astroid/protocols.py')
-rw-r--r--astroid/protocols.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/astroid/protocols.py b/astroid/protocols.py
index 84e3571b..891af0f6 100644
--- a/astroid/protocols.py
+++ b/astroid/protocols.py
@@ -328,7 +328,7 @@ def _arguments_infer_argname(self, name, context):
yield cls
return
if functype == "method":
- yield bases.Instance(cls)
+ yield cls.instantiate_class()
return
if context and context.callcontext:
@@ -341,7 +341,7 @@ def _arguments_infer_argname(self, name, context):
vararg.parent = self
if not self.arguments and self.parent.name == "__init__":
cls = self.parent.parent.scope()
- vararg.elts = [bases.Instance(cls)]
+ vararg.elts = [cls.instantiate_class()]
yield vararg
return
if name == self.kwarg: