# HG changeset patch # User Matt Mackall # Date 2011-11-03 16:24:55 # Node ID ee112eb69d2aaed1ceb6922cb9c2cbc3fd893a0b # Parent a708b65baeb92ce4971cccaee5b799b88595ddb2 misc: adding missing file close() calls Spotted by Victor Stinner diff --git a/mercurial/ignore.py b/mercurial/ignore.py --- a/mercurial/ignore.py +++ b/mercurial/ignore.py @@ -78,6 +78,7 @@ def ignore(root, files, warn): 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: diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -800,6 +800,7 @@ class revlog(object): readahead = max(65536, length) df.seek(offset) d = df.read(readahead) + df.close() self._addchunk(offset, d) if readahead > length: return d[:length] diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -79,6 +79,7 @@ class ui(object): try: cfg.read(filename, fp, sections=sections, remap=remap) + fp.close() except error.ConfigError, inst: if trusted: raise