summaryrefslogtreecommitdiff
path: root/astroid/protocols.py
diff options
context:
space:
mode:
authorRam Rachum <ram@rachum.com>2020-06-20 13:17:00 +0300
committerGitHub <noreply@github.com>2020-06-20 12:17:00 +0200
commit184b591ec79468d75be03835ee0d6fd12343d93a (patch)
treeb9ff994b36f08b22a11269405ea37b84424ee7dd /astroid/protocols.py
parent92f556842c84a2b3cc33a1638fc625b4f67d0d1f (diff)
downloadastroid-git-184b591ec79468d75be03835ee0d6fd12343d93a.tar.gz
Fix exception causes all over the codebase (#806)
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 2cdf5548..dc66ca2c 100644
--- a/astroid/protocols.py
+++ b/astroid/protocols.py
@@ -498,8 +498,8 @@ def _infer_context_manager(self, mgr, context):
elif isinstance(inferred, bases.Instance):
try:
enter = next(inferred.igetattr("__enter__", context=context))
- except (exceptions.InferenceError, exceptions.AttributeInferenceError):
- raise exceptions.InferenceError(node=inferred)
+ except (exceptions.InferenceError, exceptions.AttributeInferenceError) as exc:
+ raise exceptions.InferenceError(node=inferred) from exc
if not isinstance(enter, bases.BoundMethod):
raise exceptions.InferenceError(node=enter)
yield from enter.infer_call_result(self, context)