summaryrefslogtreecommitdiff
path: root/astroid/protocols.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2018-07-31 09:47:23 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2018-07-31 09:47:23 +0200
commitf0044dd8b6d8d3d8f2e0b0291c105ac0dda38664 (patch)
tree2bf0f41ec8c93671b2e303b81db55b625911150f /astroid/protocols.py
parent2894a1a392ba564ad05ce695cfc35b11340049fc (diff)
downloadastroid-git-f0044dd8b6d8d3d8f2e0b0291c105ac0dda38664.tar.gz
infer_call_result can raise InferenceError so make sure to handle that for the call sites where it is used
infer_call_result started recently to raise InferenceError for objects for which it could not find any returns. Previously it was silently raising a StopIteration, which was especially leaking when calling builtin methods. Since it is after all an inference method, it is expected that it could raise an InferenceError rather than returning nothing. Close PyCQA/pylint#2350
Diffstat (limited to 'astroid/protocols.py')
-rw-r--r--astroid/protocols.py3
1 files changed, 1 insertions, 2 deletions
diff --git a/astroid/protocols.py b/astroid/protocols.py
index 0397595d..91fe5a34 100644
--- a/astroid/protocols.py
+++ b/astroid/protocols.py
@@ -477,8 +477,7 @@ def _infer_context_manager(self, mgr, context):
return
if not context.callcontext:
context.callcontext = contextmod.CallContext(args=[inferred])
- for result in enter.infer_call_result(self, context):
- yield result
+ yield from enter.infer_call_result(self, context)
@decorators.raise_if_nothing_inferred