[pypy-commit] pypy default: Must close the file explicitly; otherwise, on Windows, we cannot unlink it before the GC runs

arigo noreply at buildbot.pypy.org
Wed Nov 9 17:41:06 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r49027:d44e050d460e
Date: 2011-11-09 17:28 +0100
http://bitbucket.org/pypy/pypy/changeset/d44e050d460e/

Log:	Must close the file explicitly; otherwise, on Windows, we cannot
	unlink it before the GC runs

diff --git a/lib-python/2.7/test/test_os.py b/lib-python/2.7/test/test_os.py
--- a/lib-python/2.7/test/test_os.py
+++ b/lib-python/2.7/test/test_os.py
@@ -74,7 +74,8 @@
         self.assertFalse(os.path.exists(name),
                     "file already exists for temporary file")
         # make sure we can create the file
-        open(name, "w")
+        f = open(name, "w")
+        f.close()
         self.files.append(name)
 
     def test_tempnam(self):


More information about the pypy-commit mailing list