diff mercurial/statichttprepo.py @ 13400:14f3795a5ed7

explicitly close files Add missing calls to close() to many places where files are opened. Relying on reference counting to catch them soon-ish is not portable and fails in environments with a proper GC, such as PyPy.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Fri, 24 Dec 2010 15:23:01 +0100
parents 61c9bc3da402
children 643b8212813e
line wrap: on
line diff
--- a/mercurial/statichttprepo.py	Fri Feb 11 22:24:10 2011 +0800
+++ b/mercurial/statichttprepo.py	Fri Dec 24 15:23:01 2010 +0100
@@ -98,7 +98,9 @@
                 raise
             # check if it is a non-empty old-style repository
             try:
-                self.opener("00changelog.i").read(1)
+                fp = self.opener("00changelog.i")
+                fp.read(1)
+                fp.close()
             except IOError, inst:
                 if inst.errno != errno.ENOENT:
                     raise