This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author meador.inge
Recipients brian.curtin, eric.araujo, ezio.melotti, jaime.buelta, lars.gustaebel, meador.inge, r.david.murray
Date 2010-02-28.17:08:41
SpamBayes Score 3.2640557e-14
Marked as misclassified No
Message-id <1267376923.26.0.706010343163.issue7232@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2010-02-28 17:08:43meador.ingesetrecipients: + meador.inge, lars.gustaebel, ezio.melotti, eric.araujo, r.david.murray, brian.curtin, jaime.buelta
2010-02-28 17:08:43meador.ingesetmessageid: <1267376923.26.0.706010343163.issue7232@psf.upfronthosting.co.za>
2010-02-28 17:08:41meador.ingelinkissue7232 messages
2010-02-28 17:08:41meador.ingecreate