Mercurial > public > mercurial-scm > hg-stable
diff mercurial/hg.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 | 8a0fca925992 |
children | 30273f0c776b |
line wrap: on
line diff
--- a/mercurial/hg.py Mon May 02 10:11:05 2011 +0200 +++ b/mercurial/hg.py Mon May 02 10:11:18 2011 +0200 @@ -137,14 +137,14 @@ requirements = '' try: - requirements = srcrepo.opener('requires').read() + requirements = srcrepo.opener.read('requires') except IOError, inst: if inst.errno != errno.ENOENT: raise requirements += 'shared\n' - file(os.path.join(roothg, 'requires'), 'w').write(requirements) - file(os.path.join(roothg, 'sharedpath'), 'w').write(sharedpath) + util.writefile(os.path.join(roothg, 'requires'), requirements) + util.writefile(os.path.join(roothg, 'sharedpath'), sharedpath) r = repository(ui, root)