[Python-Dev] Another PEP 343 contextmanager glitch

Phillip J. Eby pje at telecommunity.com
Sat Mar 25 01:01:32 CET 2006


At 03:50 PM 3/24/2006 -0800, Guido van Rossum wrote:
>I'm not against recommending in the PEP that __exit__ shouldn't
>re-raise but instead should return False to signal a re-raise, and
>fixing any existing code that re-raises in __exit__. But I'm still
>questioning your use case; why is it important not to call the outer
>__exit__ methods in your case?

I didn't say it was important not to call them; I said it was important to 
be able to *tell* whether any of the __exit__ methods had actually failed, 
since this indicates a critical failure of transaction rollback.  That is, 
there was some part of the transaction that could not be rolled back.  This 
is a distinct issue from whatever caused the transaction to be 
aborted.  Also, the __exit__ methods that failed should be logged, but not 
the __exit__ methods that are simply propagating an exception after 
performing their rollback behavior.



More information about the Python-Dev mailing list