summaryrefslogtreecommitdiff
path: root/Lib/contextlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/contextlib.py')
-rw-r--r--Lib/contextlib.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/contextlib.py b/Lib/contextlib.py
index 418a3b7820..aa5335d9c4 100644
--- a/Lib/contextlib.py
+++ b/Lib/contextlib.py
@@ -31,11 +31,11 @@ class GeneratorContextManager(object):
try:
self.gen.throw(type, value, traceback)
raise RuntimeError("generator didn't stop after throw()")
- except StopIteration:
+ except StopIteration, exc:
# Suppress the exception *unless* it's the same exception that
# was passed to throw(). This prevents a StopIteration
# raised inside the "with" statement from being suppressed
- return sys.exc_info()[1] is not value
+ return exc is not value
except:
# only re-raise if it's *not* the exception that was
# passed to throw(), because __exit__() must not raise