atomictempfile: fix exception in __del__ if mktempcopy fails (self._fp is None)
Make what is going on more obvious by explicitely getting the 'closed'
attribute from _fp, instead of from the gettatr proxy.
--- a/mercurial/util.py Thu Jun 11 12:23:08 2009 -0700
+++ b/mercurial/util.py Sat Jun 13 13:14:02 2009 +0200
@@ -767,17 +767,18 @@
return getattr(self._fp, name)
def rename(self):
- if not self.closed:
+ if not self._fp.closed:
self._fp.close()
rename(self.temp, localpath(self.__name))
def __del__(self):
- if not self.closed:
+ if not self._fp:
+ return
+ if not self._fp.closed:
try:
os.unlink(self.temp)
except: pass
- if self._fp:
- self._fp.close()
+ self._fp.close()
def makedirs(name, mode=None):
"""recursive directory creation with parent mode inheritance"""