summaryrefslogtreecommitdiff
path: root/astroid/objects.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2019-01-17 15:24:04 +0100
committerClaudiu Popa <pcmanticore@gmail.com>2019-01-17 15:24:04 +0100
commit041366cc7a0fecaccbb17421571f996cc645fe26 (patch)
tree0d42f0a015816e26cb04cdc9f86030d80bf5a6aa /astroid/objects.py
parent0d4f73d02943b77739e4d0053f20d9aac855b1f0 (diff)
downloadastroid-git-041366cc7a0fecaccbb17421571f996cc645fe26.tar.gz
Add a registry for builtin exception models. Close PyCQA/pylint#1432
Diffstat (limited to 'astroid/objects.py')
-rw-r--r--astroid/objects.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/astroid/objects.py b/astroid/objects.py
index 367f650e..1a071b2c 100644
--- a/astroid/objects.py
+++ b/astroid/objects.py
@@ -210,10 +210,13 @@ class ExceptionInstance(bases.Instance):
the case of .args.
"""
- # pylint: disable=unnecessary-lambda
- special_attributes = util.lazy_descriptor(
- lambda: objectmodel.ExceptionInstanceModel()
- )
+ @decorators.cachedproperty
+ def special_attributes(self):
+ qname = self.qname()
+ instance = objectmodel.BUILTIN_EXCEPTIONS.get(
+ qname, objectmodel.ExceptionInstanceModel
+ )
+ return instance()
class DictInstance(bases.Instance):