[Python-checkins] r45236 - python/trunk/Lib/contextlib.py

phillip.eby python-checkins at python.org
Mon Apr 10 19:56:30 CEST 2006


Author: phillip.eby
Date: Mon Apr 10 19:56:29 2006
New Revision: 45236

Modified:
   python/trunk/Lib/contextlib.py
Log:
Minor clarity edit to contextlib per Guido's request.


Modified: python/trunk/Lib/contextlib.py
==============================================================================
--- python/trunk/Lib/contextlib.py	(original)
+++ python/trunk/Lib/contextlib.py	Mon Apr 10 19:56:29 2006
@@ -31,11 +31,11 @@
             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


More information about the Python-checkins mailing list