summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/tempfile.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index 32b83a0..dff2ae9 100644
--- a/Lib/tempfile.py
+++ b/Lib/tempfile.py
@@ -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: