summaryrefslogtreecommitdiffstats
path: root/Lib/contextlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/contextlib.py')
-rw-r--r--Lib/contextlib.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/contextlib.py b/Lib/contextlib.py
index aa5335d..157b4cc 100644
--- a/Lib/contextlib.py
+++ b/Lib/contextlib.py
@@ -127,7 +127,10 @@ def nested(*contexts):
except:
exc = sys.exc_info()
if exc != (None, None, None):
- raise
+ # Don't rely on sys.exc_info() still containing
+ # the right information. Another exception may
+ # have been raised and caught by an exit method
+ raise exc[0], exc[1], exc[2]
@contextmanager