diff options
author | AlexSm <[email protected]> | 2024-01-09 18:56:40 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-01-09 18:56:40 +0100 |
commit | e95f266d2a3e48e62015220588a4fd73d5d5a5cb (patch) | |
tree | a8a784b6931fe52ad5f511cfef85af14e5f63991 /contrib/python/contextlib2/py3 | |
parent | 50a65e3b48a82d5b51f272664da389f2e0b0c99a (diff) |
Library import 6 (#888)
Diffstat (limited to 'contrib/python/contextlib2/py3')
-rw-r--r-- | contrib/python/contextlib2/py3/contextlib2/__init__.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/python/contextlib2/py3/contextlib2/__init__.py b/contrib/python/contextlib2/py3/contextlib2/__init__.py index d6c0c4ac4af..63ecced65a4 100644 --- a/contrib/python/contextlib2/py3/contextlib2/__init__.py +++ b/contrib/python/contextlib2/py3/contextlib2/__init__.py @@ -177,8 +177,10 @@ class _GeneratorContextManager(_GeneratorContextManagerBase, # Need to force instantiation so we can reliably # tell if we get the same exception back value = type() + if traceback is not None: + value = value.with_traceback(traceback) try: - self.gen.throw(type, value, traceback) + self.gen.throw(value) except StopIteration as exc: # Suppress StopIteration *unless* it's the same exception that # was passed to throw(). This prevents a StopIteration |