# HG changeset patch # User Matt Mackall # Date 2008-01-11 20:06:05 # Node ID c67dfc4ecba652b1a9eb2e23a8562f7b682af7e8 # Parent 59fba5caa94ba53f0cf6e4c3ec5d3238a882b492 posixfile_nt: set closed early Exceptions in __init__ may leave us with close undefined in __del__ diff --git a/mercurial/util_win32.py b/mercurial/util_win32.py --- a/mercurial/util_win32.py +++ b/mercurial/util_win32.py @@ -227,6 +227,9 @@ class posixfile_nt(object): # 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 @@ class posixfile_nt(object): 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):