Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.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 | c18204fd35b0 |
children | 21b8ce4d3331 |
comparison
equal
deleted
inserted
replaced
14167:0e4753807c93 | 14168:135e244776f0 |
---|---|
89 if not message and logfile: | 89 if not message and logfile: |
90 try: | 90 try: |
91 if logfile == '-': | 91 if logfile == '-': |
92 message = sys.stdin.read() | 92 message = sys.stdin.read() |
93 else: | 93 else: |
94 message = open(logfile).read() | 94 message = util.readfile(logfile) |
95 except IOError, inst: | 95 except IOError, inst: |
96 raise util.Abort(_("can't read commit message '%s': %s") % | 96 raise util.Abort(_("can't read commit message '%s': %s") % |
97 (logfile, inst.strerror)) | 97 (logfile, inst.strerror)) |
98 return message | 98 return message |
99 | 99 |