diff options
author | Claudiu Popa <pcmanticore@gmail.com> | 2019-01-17 15:24:04 +0100 |
---|---|---|
committer | Claudiu Popa <pcmanticore@gmail.com> | 2019-01-17 15:24:04 +0100 |
commit | 041366cc7a0fecaccbb17421571f996cc645fe26 (patch) | |
tree | 0d42f0a015816e26cb04cdc9f86030d80bf5a6aa /astroid/objects.py | |
parent | 0d4f73d02943b77739e4d0053f20d9aac855b1f0 (diff) | |
download | astroid-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.py | 11 |
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): |