Lars Gustäbel <l...@gustaebel.de> added the comment:

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.

----------
Added file: http://bugs.python.org/file16400/issue7232.8.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7232>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to