Commit 1749b252 authored by Tim Peters's avatar Tim Peters

_once(): Removed obfuscating aliasing of _once_lock.

parent fd0f0c9f
......@@ -98,19 +98,17 @@ def _once(var, initializer):
"""
vars = globals()
lock = _once_lock
# Check first outside the lock.
if vars.get(var) is not None:
return
try:
lock.acquire()
_once_lock.acquire()
# Check again inside the lock.
if vars.get(var) is not None:
return
vars[var] = initializer()
finally:
lock.release()
_once_lock.release()
class _RandomNameSequence:
"""An instance of _RandomNameSequence generates an endless
......
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