[Python-Dev] Another PEP 343 contextmanager glitch (original) (raw)
Phillip J. Eby pje at telecommunity.com
Sat Mar 25 00:43:14 CET 2006
- Previous message: [Python-Dev] Another PEP 343 contextmanager glitch
- Next message: [Python-Dev] Another PEP 343 contextmanager glitch
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
At 03:27 PM 3/24/2006 -0800, Guido van Rossum wrote:
I guess I like the ambiguity -- to the outer exit, it shouldn't make any difference whether the exception was re-raised by the inner exit or by the finally clause containing it. After all, if there wasn't an outer exit, there wouldn't be any difference to the user either, whether the re-raise came from exit or from finally.
If you still disagree, can you produce a test case that's currently broken?
I discovered the issue when I updated to the latest implementation and it broke the tests for a context manager I had written. This context manager is basically a transaction manager that accumulates context managers for resources used in the transaction, then calls all their exit() methods from its exit. It has to be able to distinguish between an exit() that failed (which means a critical failure of the overall transaction!) and an exit that's merely allowing the original exception to propagate (which means that the other handlers should still be invoked, and that everything's working normally).
- Previous message: [Python-Dev] Another PEP 343 contextmanager glitch
- Next message: [Python-Dev] Another PEP 343 contextmanager glitch
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]