Martin Panter added the comment:

I had another look at the five patches you mentioned. I made a couple review 
comments about expanding the scope of some “with” statements.

There are a couple changes that add explicit file closing, where it was 
previously up to the garbage collector. I.e. code like open(...).read(). I 
think those changes are the most important, although they are scattered over 
the various patches.

On the other hand, some of the changes in the test suite, particularly 
test_dbm_dumb.py and test_xmlrpc.py, hardly seem worth it. The main benefit of 
the “with” statement would be if the test code fails, which hopefully won’t 
happen that often. :)

In the test suite, perhaps it would be better to call self.addCleanup(f.close) 
or similar in many cases. That way you wouldn’t need contextlib.closing() as 
much, and there would be less file history clutter and “cavern code”, due to 
the extra indentation.

----------

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

Reply via email to