Author lars.gustaebel
Recipients brian.curtin, ezio.melotti, jaime.buelta, lars.gustaebel, meador.inge, merwok, r.david.murray
Date 2010-02-28.19:02:36
SpamBayes Score 7.288e-12
Marked as misclassified No
Message-id <1267383759.05.0.333941774395.issue7232@psf.upfronthosting.co.za>
In-reply-to
Content
IMO it is okay for __enter__() and __exit__() not to have docstrings.
I cannot see what's so special about the behaviour of __enter__() and __exit__().

__enter__() raises IOError only if the TarFile object has been already closed. This is exactly the behaviour I would expect, because it is the same every other TarFile method does when the object has been closed. IOW, using a closed TarFile as a context manager is the programmer's mistake, and I don't feel the need to document that case.

The fact that __exit__() only closes the TarFile object and does not swallow exceptions is what everyone expects from a "file object". It is the only logical thing to do, no need to document that either.

The test_context_manager_exception() test is fine. If the call to tarfile.open() really raises an exception then something is so terribly wrong and probably all of the testsuite's 200 tests will fail anyway. We can safely assume here that this will work, no need to double-check.

However, I have changed the docs again to be a bit more specific.
History
Date User Action Args
2010-02-28 19:02:39lars.gustaebelsetrecipients: + lars.gustaebel, ezio.melotti, merwok, r.david.murray, brian.curtin, meador.inge, jaime.buelta
2010-02-28 19:02:39lars.gustaebelsetmessageid: <1267383759.05.0.333941774395.issue7232@psf.upfronthosting.co.za>
2010-02-28 19:02:37lars.gustaebellinkissue7232 messages
2010-02-28 19:02:37lars.gustaebelcreate