Mercurial > hg
comparison hgext/convert/subversion.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 | 00121103546a |
children | df2399663392 |
comparison
equal
deleted
inserted
replaced
14167:0e4753807c93 | 14168:135e244776f0 |
---|---|
1026 try: | 1026 try: |
1027 if os.path.islink(self.wjoin(filename)): | 1027 if os.path.islink(self.wjoin(filename)): |
1028 os.unlink(filename) | 1028 os.unlink(filename) |
1029 except OSError: | 1029 except OSError: |
1030 pass | 1030 pass |
1031 self.wopener(filename, 'w').write(data) | 1031 self.wopener.write(filename, data) |
1032 | 1032 |
1033 if self.is_exec: | 1033 if self.is_exec: |
1034 was_exec = self.is_exec(self.wjoin(filename)) | 1034 was_exec = self.is_exec(self.wjoin(filename)) |
1035 else: | 1035 else: |
1036 # On filesystems not supporting execute-bit, there is no way | 1036 # On filesystems not supporting execute-bit, there is no way |