Mercurial > public > mercurial-scm > hg
diff hgext/mq.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 | 3c616f512a5b |
children | bab267e7fc1a |
line wrap: on
line diff
--- a/hgext/mq.py Mon May 02 10:11:05 2011 +0200 +++ b/hgext/mq.py Mon May 02 10:11:18 2011 +0200 @@ -291,14 +291,14 @@ elif l.strip(): self.ui.warn(_('malformated mq status line: %s\n') % entry) # else we ignore empty lines - lines = self.opener(self.status_path).read().splitlines() + lines = self.opener.read(self.status_path).splitlines() return list(parselines(lines)) return [] @util.propertycache def full_series(self): if os.path.exists(self.join(self.series_path)): - return self.opener(self.series_path).read().splitlines() + return self.opener.read(self.series_path).splitlines() return [] @util.propertycache @@ -412,7 +412,7 @@ if self.active_guards is None: self.active_guards = [] try: - guards = self.opener(self.guards_path).read().split() + guards = self.opener.read(self.guards_path).split() except IOError, err: if err.errno != errno.ENOENT: raise