[pypy-svn] pypy default: One missing f.close().

arigo commits-noreply at bitbucket.org
Thu Feb 10 15:14:02 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r41780:559784617931
Date: 2011-02-10 15:13 +0100
http://bitbucket.org/pypy/pypy/changeset/559784617931/

Log:	One missing f.close().

	Only call _create_file() once, not at the start of every thread.

diff --git a/lib-python/modified-2.7.0/test/test_file2k.py b/lib-python/modified-2.7.0/test/test_file2k.py
--- a/lib-python/modified-2.7.0/test/test_file2k.py
+++ b/lib-python/modified-2.7.0/test/test_file2k.py
@@ -389,6 +389,7 @@
             if lines != testlines:
                 self.fail("readlines() after next() with empty buffer "
                           "failed. Got %r, expected %r" % (line, testline))
+            f.close()
             # Reading after iteration hit EOF shouldn't hurt either
             f = open(TESTFN)
             try:
@@ -497,7 +498,6 @@
 
     def _test_close_open_io(self, io_func, nb_workers=5):
         def worker():
-            self._create_file()
             funcs = itertools.cycle((
                 lambda: io_func(),
                 lambda: self._close_and_reopen_file(),
@@ -509,6 +509,7 @@
                     f()
                 except (IOError, ValueError):
                     pass
+        self._create_file()
         self._run_workers(worker, nb_workers)
         if test_support.verbose:
             # Useful verbose statistics when tuning this test to take


More information about the Pypy-commit mailing list