state.Lock: initialize self.owner first, to avoid problems in __del__
...if an exception is ever thrown in _sname(). Which shouldn't happen, but we might as well be careful.
This commit is contained in:
parent
f644f3bd04
commit
cd702a8126
1 changed files with 1 additions and 1 deletions
2
state.py
2
state.py
|
|
@ -109,9 +109,9 @@ def start(t):
|
||||||
|
|
||||||
class Lock:
|
class Lock:
|
||||||
def __init__(self, t):
|
def __init__(self, t):
|
||||||
|
self.owned = False
|
||||||
self.lockname = _sname('lock', t)
|
self.lockname = _sname('lock', t)
|
||||||
self.tmpname = _sname('lock%d' % os.getpid(), t)
|
self.tmpname = _sname('lock%d' % os.getpid(), t)
|
||||||
self.owned = False
|
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
if self.owned:
|
if self.owned:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue