Kaydet (Commit) ccc7bb4e authored tarafından Phillip J. Eby's avatar Phillip J. Eby

More extensive comment on __exit__ handling, per Guido's request.

üst e33901eb
......@@ -34,6 +34,13 @@ class GeneratorContextManager(object):
except StopIteration:
return True
except:
# only re-raise if it's *not* the exception that was
# passed to throw(), because __exit__() must not raise
# an exception unless __exit__() itself failed. But throw()
# has to raise the exception to signal propagation, so this
# fixes the impedance mismatch between the throw() protocol
# and the __exit__() protocol.
#
if sys.exc_info()[1] is not value:
raise
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment