diff options
author | Phillip J. Eby <pje@telecommunity.com> | 2006-04-10 17:56:29 (GMT) |
---|---|---|
committer | Phillip J. Eby <pje@telecommunity.com> | 2006-04-10 17:56:29 (GMT) |
commit | 93149d935d08c5ea1c21ebc74d11016026c0a6b6 (patch) | |
tree | 491e599c825584594d7ea8d02c6d1716de919998 /Lib | |
parent | 2ba96610bfeda03381dd411d5694fae311159a0c (diff) | |
download | cpython-93149d935d08c5ea1c21ebc74d11016026c0a6b6.zip cpython-93149d935d08c5ea1c21ebc74d11016026c0a6b6.tar.gz cpython-93149d935d08c5ea1c21ebc74d11016026c0a6b6.tar.bz2 |
Minor clarity edit to contextlib per Guido's request.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/contextlib.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/contextlib.py b/Lib/contextlib.py index 418a3b7..aa5335d 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 |