changeset 5840:c67dfc4ecba6

posixfile_nt: set closed early Exceptions in __init__ may leave us with close undefined in __del__
author Matt Mackall <mpm@selenic.com>
date Fri, 11 Jan 2008 14:06:05 -0600
parents 59fba5caa94b
children 07ca22a72dcc
files mercurial/util_win32.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util_win32.py	Wed Jan 09 10:00:18 2008 -0600
+++ b/mercurial/util_win32.py	Fri Jan 11 14:06:05 2008 -0600
@@ -227,6 +227,9 @@
     # but does not work at all. wrap win32 file api instead.
 
     def __init__(self, name, mode='rb'):
+        self.closed = False
+        self.name = name
+        self.mode = mode
         access = 0
         if 'r' in mode or '+' in mode:
             access |= win32file.GENERIC_READ
@@ -250,9 +253,6 @@
                                                0)
         except pywintypes.error, err:
             raise WinIOError(err, name)
-        self.closed = False
-        self.name = name
-        self.mode = mode
 
     def __iter__(self):
         for line in self.read().splitlines(True):