]> granicus.if.org Git - python/commitdiff
Minor clarity edit to contextlib per Guido's request.
authorPhillip J. Eby <pje@telecommunity.com>
Mon, 10 Apr 2006 17:56:29 +0000 (17:56 +0000)
committerPhillip J. Eby <pje@telecommunity.com>
Mon, 10 Apr 2006 17:56:29 +0000 (17:56 +0000)
Lib/contextlib.py

index 418a3b78208e65467bac16ddee230fa100cbb959..aa5335d9c4c53e373af270edb91cbcc46831e685 100644 (file)
@@ -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