Mercurial > public > mercurial-scm > hg
diff hgext/convert/darcs.py @ 14168:135e244776f0
prevent transient leaks of file handle by using new helper functions
These leaks may occur in environments that don't employ a reference
counting GC, i.e. PyPy.
This implies:
- changing opener(...).read() calls to opener.read(...)
- changing opener(...).write() calls to opener.write(...)
- changing open(...).read(...) to util.readfile(...)
- changing open(...).write(...) to util.writefile(...)
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Mon, 02 May 2011 10:11:18 +0200 |
parents | 4e5a36eeefd1 |
children | dbdb777502dc |
line wrap: on
line diff
--- a/hgext/convert/darcs.py Mon May 02 10:11:05 2011 +0200 +++ b/hgext/convert/darcs.py Mon May 02 10:11:18 2011 +0200 @@ -191,7 +191,7 @@ if rev != self.lastrev: raise util.Abort(_('internal calling inconsistency')) path = os.path.join(self.tmppath, name) - data = open(path, 'rb').read() + data = util.readfile(path) mode = os.lstat(path).st_mode mode = (mode & 0111) and 'x' or '' return data, mode