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

2010-03-03 Thread Lars Gustäbel
Lars Gustäbel l...@gustaebel.de added the comment: Okay, it is done, see r78623 (trunk) and r78626 (py3k). Thanks to all for your work and support! -- resolution: - accepted status: open - closed ___ Python tracker rep...@bugs.python.org

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

2010-03-03 Thread Lars Gustäbel
Changes by Lars Gustäbel l...@gustaebel.de: -- stage: patch review - committed/rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7232 ___ ___

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

2010-02-28 Thread Lars Gustäbel
Lars Gustäbel l...@gustaebel.de added the comment: Another version of the patch (issue7232.6.diff) that checks if the TarFile object is still open in the __enter__() method (plus a test for that). I removed the docstrings as Eric suggested. This is common practice in the standard library.

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

2010-02-28 Thread Meador Inge
Meador Inge mead...@gmail.com added the comment: 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.

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

2010-02-28 Thread Lars Gustäbel
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

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

2010-02-27 Thread Meador Inge
Meador Inge mead...@gmail.com added the comment: What about changing the exception test to something like what I did in issue7232.4.diff? That is definitely more succinct, but Lars' solution provides more information about _why_ the test fails. IMHO, the descriptiveness is more important

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

2010-02-27 Thread Brian Curtin
Brian Curtin cur...@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

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

2010-02-27 Thread Éric Araujo
Éric Araujo mer...@netwok.org added the comment: Hello Minor note: I think magic methods shouldn’t have docstrings, because their name is enough doc (or at least enough to go read the doc). At most a one-line comment like “context protocol” can be useful. (The exception is __init__, which

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

2010-02-24 Thread Meador Inge
Meador Inge mead...@gmail.com added the comment: Built on Brian's patch by adding the following items: * Added a unit test case to cover exceptional conditions. * Added doc strings on __enter__ and __exit__ (more consistent with the surrounding code). * Spelling error in doc

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

2010-02-22 Thread Brian Curtin
Brian Curtin cur...@acm.org added the comment: The last patch does more than it should for this issue. Here is a minimal patch with the change, test, and doc updates. -- Added file: http://bugs.python.org/file16307/issue7232.diff ___ Python tracker

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

2010-02-21 Thread Brian Curtin
Brian Curtin cur...@acm.org added the comment: Here is a patch which expands on Jaime's patch. I was converting tests for #7944 and looked at test_tarfile, and implemented the same feature that he did. All places where context managers should be used in the test, they are used. Includes a doc

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

2010-02-21 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Woops, I accidentally deleted one of the patch files. Adding back. -- nosy: +r.david.murray Added file: http://bugs.python.org/file16291/tarfileWithSupportv2.patch ___ Python tracker

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

2009-10-29 Thread Jaime Buelta
New submission from Jaime Buelta jaime.bue...@gmail.com: Currently, the TarFile is not supporting the 'with' statement, which I think it should for coherence with other file classes. I've already created a patch including it for consideration. -- components: Library (Lib) files:

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

2009-10-29 Thread Lars Gustäbel
Lars Gustäbel l...@gustaebel.de added the comment: Please clean up the patch, and I take another look at it. -- assignee: - lars.gustaebel nosy: +lars.gustaebel ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7232

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

2009-10-29 Thread Jaime Buelta
Jaime Buelta jaime.bue...@gmail.com added the comment: I've cleaned the patch, I don't now why Eclipse added a lot of garbage, sorry. -- Added file: http://bugs.python.org/file15221/tarfileWithSupportv2.patch ___ Python tracker rep...@bugs.python.org

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

2009-10-29 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti priority: - normal stage: - patch review versions: +Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7232 ___