misc: adding missing file close() calls stable
authorMatt Mackall <mpm@selenic.com>
Thu, 03 Nov 2011 11:24:55 -0500
branchstable
changeset 15407 ee112eb69d2a
parent 15401 a708b65baeb9
child 15408 db8b0ee74025
misc: adding missing file close() calls Spotted by Victor Stinner <victor.stinner@haypocalc.com>
mercurial/ignore.py
mercurial/revlog.py
mercurial/ui.py
--- a/mercurial/ignore.py	Tue Nov 01 15:37:00 2011 -0500
+++ b/mercurial/ignore.py	Thu Nov 03 11:24:55 2011 -0500
@@ -78,6 +78,7 @@
             pats[f] = []
             fp = open(f)
             pats[f], warnings = ignorepats(fp)
+            fp.close()
             for warning in warnings:
                 warn("%s: %s\n" % (f, warning))
         except IOError, inst:
--- a/mercurial/revlog.py	Tue Nov 01 15:37:00 2011 -0500
+++ b/mercurial/revlog.py	Thu Nov 03 11:24:55 2011 -0500
@@ -800,6 +800,7 @@
         readahead = max(65536, length)
         df.seek(offset)
         d = df.read(readahead)
+        df.close()
         self._addchunk(offset, d)
         if readahead > length:
             return d[:length]
--- a/mercurial/ui.py	Tue Nov 01 15:37:00 2011 -0500
+++ b/mercurial/ui.py	Thu Nov 03 11:24:55 2011 -0500
@@ -79,6 +79,7 @@
 
         try:
             cfg.read(filename, fp, sections=sections, remap=remap)
+            fp.close()
         except error.ConfigError, inst:
             if trusted:
                 raise