mercurial/util.py
changeset 8785 7a9151bc5b37
parent 8778 c5f36402daad
child 8938 9b8c9266c59d
--- 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"""