Message100210
> This is common practice in the standard library.
This doesn't necessarily mean it is a correct practice :-). All
kidding aside, I think the assumption that the standard documentation
on '__enter__' and '__exit__' is sufficient is a bad one. With respect
to how the 'tarfile' versions of these methods behave, that
documentation is not that helpful.
In particular, the special behavior of an 'IOError' potentially being
thrown from '__enter__' and the fact that '__exit__' does not swallow
the exception. These special behaviors should be documented either in
a docstring or the library documentation. I think this is important,
but I may be being a bit pedantic.
Also, the last change to 'test_context_manager_exception' has a bug.
If the call to 'tarfile.open' throws an exception, then the call to
'self.assertRaises' will swallow it. This will cause an undefined
variable reference to 'tar' in 'self.assertTrue(tar.closed, ...)'. I
attached another update that fixes this problem. |
|
Date |
User |
Action |
Args |
2010-02-28 17:08:43 | meador.inge | set | recipients:
+ meador.inge, lars.gustaebel, ezio.melotti, eric.araujo, r.david.murray, brian.curtin, jaime.buelta |
2010-02-28 17:08:43 | meador.inge | set | messageid: <1267376923.26.0.706010343163.issue7232@psf.upfronthosting.co.za> |
2010-02-28 17:08:41 | meador.inge | link | issue7232 messages |
2010-02-28 17:08:41 | meador.inge | create | |
|