Mercurial > public > mercurial-scm > hg
diff mercurial/help.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 | 0528b69f8db4 |
children | d5b525697ddb |
line wrap: on
line diff
--- a/mercurial/help.py Mon May 02 10:11:05 2011 +0200 +++ b/mercurial/help.py Mon May 02 10:11:18 2011 +0200 @@ -8,6 +8,7 @@ from i18n import gettext, _ import sys, os import extensions +import util def moduledoc(file): @@ -79,7 +80,7 @@ break path = os.path.join(docdir, topic + ".txt") - doc = gettext(open(path).read()) + doc = gettext(util.readfile(path)) for rewriter in helphooks.get(topic, []): doc = rewriter(topic, doc) return doc