state.Lock: destructor: unlock before closing, not the other way around.

This commit is contained in:
Avery Pennarun 2011-01-18 00:07:33 -08:00
commit 340aad1797

View file

@ -308,9 +308,9 @@ class Lock:
def __del__(self): def __del__(self):
_locks[self.fid] = 0 _locks[self.fid] = 0
os.close(self.lockfile)
if self.owned: if self.owned:
self.unlock() self.unlock()
os.close(self.lockfile)
def trylock(self): def trylock(self):
assert(not self.owned) assert(not self.owned)