diff options
| author | Claudiu Popa <pcmanticore@gmail.com> | 2020-05-01 17:59:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-01 17:59:20 +0200 |
| commit | c77a5745e42d6c6d5334f83e2af3a3f6a1b618b5 (patch) | |
| tree | e80b74ceecf771e73a4eb98eaebc6747ad5612c8 /astroid | |
| parent | a3d86bd465775ad158c3372a99e8014bd33fd991 (diff) | |
| download | astroid-git-c77a5745e42d6c6d5334f83e2af3a3f6a1b618b5.tar.gz | |
Protect against ``infer_call_result`` failing with `InferenceError` in `Super.getattr()` (#782)
``infer_call_result`` can raise InferenceError but we were not handling that when retrieving
objects from the Super instance.
Close PyCQA/pylint#3529
Diffstat (limited to 'astroid')
| -rw-r--r-- | astroid/objects.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/astroid/objects.py b/astroid/objects.py index 68d74aa2..fb782e6d 100644 --- a/astroid/objects.py +++ b/astroid/objects.py @@ -187,7 +187,12 @@ class Super(node_classes.NodeNG): yield inferred elif isinstance(inferred, Property): function = inferred.function - yield from function.infer_call_result(caller=self, context=context) + try: + yield from function.infer_call_result( + caller=self, context=context + ) + except exceptions.InferenceError: + yield util.Uninferable elif bases._is_property(inferred): # TODO: support other descriptors as well. try: |
