Commit fd0f0c9f authored by Tim Peters's avatar Tim Peters

_once(): Simplified dict manipulation.

parent 200788ce
......@@ -101,12 +101,12 @@ def _once(var, initializer):
lock = _once_lock
# Check first outside the lock.
if var in vars and vars[var] is not None:
if vars.get(var) is not None:
return
try:
lock.acquire()
# Check again inside the lock.
if var in vars and vars[var] is not None:
if vars.get(var) is not None:
return
vars[var] = initializer()
finally:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment