Mercurial > hg-stable
changeset 8420:f53bc3e37655
util: make atomictempfile saner if mktempcopy fails
author | Bryan O'Sullivan <bos@serpentine.com> |
---|---|
date | Thu, 14 May 2009 14:12:32 -0700 |
parents | 94e07bb8e5dd |
children | b6d0fa8c7685 |
files | mercurial/util.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Thu May 14 23:05:16 2009 +0200 +++ b/mercurial/util.py Thu May 14 14:12:32 2009 -0700 @@ -971,6 +971,7 @@ """ def __init__(self, name, mode, createmode): self.__name = name + self._fp = None self.temp = mktempcopy(name, emptyok=('w' in mode), createmode=createmode) self._fp = posixfile(self.temp, mode) @@ -988,7 +989,8 @@ try: os.unlink(self.temp) except: pass - self._fp.close() + if self._fp: + self._fp.close() def makedirs(name, mode=None): """recursive directory creation with parent mode inheritance"""