[issue7232] Support of 'with' statement fo TarFile class

Brian Curtin report at bugs.python.org
Sun Feb 28 02:21:08 CET 2010


Brian Curtin <curtin at acm.org> added the comment:

Good point. How about version 5? It uses base Exception in the context manager, which will allow us to differentiate between no exception being raised, and the wrong one being raised. After the context manager, we check the type of the exception to make sure it's correct.

I changed the exception being raised to an IOError. It could be anything, but given that AssertionError is what gets raised by the assert functions, it seemed better to avoid that one specifically. This is fairly minor, though.

If you change the "raise IOError" to be a pass statement, or another type of exception, you can see that the same level of information is given to you as in patch version 3 by Lars.

----------
Added file: http://bugs.python.org/file16394/issue7232.5.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7232>
_______________________________________


More information about the Python-bugs-list mailing list