diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2006-04-24 04:37:15 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2006-04-24 04:37:15 (GMT) |
commit | da2268feecd4b956161ed7fdd05da125606189cc (patch) | |
tree | 0e387c87ccb58228c8030ad7951db225e0a13ec1 /Lib/contextlib.py | |
parent | 27ec1a773c92b6a9a144a45334ce2b38ae6118b6 (diff) | |
download | cpython-da2268feecd4b956161ed7fdd05da125606189cc.zip cpython-da2268feecd4b956161ed7fdd05da125606189cc.tar.gz cpython-da2268feecd4b956161ed7fdd05da125606189cc.tar.bz2 |
Fix contextlib.nested to cope with exit methods raising and handling exceptions
Diffstat (limited to 'Lib/contextlib.py')
-rw-r--r-- | Lib/contextlib.py | 5 |
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 |