posixfile_nt: set closed early
Exceptions in __init__ may leave us with close undefined in __del__
--- 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):