summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2009-11-27 14:03:36 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2009-11-27 14:03:36 (GMT)
commit03f6c11f07f7f7163186c7f8cb9da086ba703162 (patch)
tree719c6643dee031138eb5532db69fb3bba044398d /Lib/logging
parent608eb2d43dc8500a86efc0e82c84727d3ce444a4 (diff)
downloadcpython-03f6c11f07f7f7163186c7f8cb9da086ba703162.zip
cpython-03f6c11f07f7f7163186c7f8cb9da086ba703162.tar.gz
cpython-03f6c11f07f7f7163186c7f8cb9da086ba703162.tar.bz2
Issue #7403: Fixed possible race condition in lock creation.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/__init__.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index 6ff2216..487a225 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -199,7 +199,11 @@ def _checkLevel(level):
#the lock would already have been acquired - so we need an RLock.
#The same argument applies to Loggers and Manager.loggerDict.
#
-_lock = None
+if thread:
+ _lock = threading.RLock()
+else:
+ _lock = None
+
def _acquireLock():
"""
@@ -207,9 +211,6 @@ def _acquireLock():
This should be released with _releaseLock().
"""
- global _lock
- if (not _lock) and thread:
- _lock = threading.RLock()
if _lock:
_lock.acquire()