diff options
Diffstat (limited to 'Lib/contextlib.py')
-rw-r--r-- | Lib/contextlib.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/Lib/contextlib.py b/Lib/contextlib.py index 6605bea..bc810b0 100644 --- a/Lib/contextlib.py +++ b/Lib/contextlib.py @@ -105,15 +105,14 @@ def nested(*managers): vars = [] exc = (None, None, None) try: - try: - for mgr in managers: - exit = mgr.__exit__ - enter = mgr.__enter__ - vars.append(enter()) - exits.append(exit) - yield vars - except: - exc = sys.exc_info() + for mgr in managers: + exit = mgr.__exit__ + enter = mgr.__enter__ + vars.append(enter()) + exits.append(exit) + yield vars + except: + exc = sys.exc_info() finally: while exits: exit = exits.pop() |