diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2009-11-27 14:03:36 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2009-11-27 14:03:36 (GMT) |
commit | 01801d1f088ca95c06a976dcd822d390d74b47d2 (patch) | |
tree | 8f4c0c49f45593d3c48d0476a129620d9d330c64 /Lib/logging | |
parent | 50ea4565bd7805d7368b9278536f58c870313e92 (diff) | |
download | cpython-01801d1f088ca95c06a976dcd822d390d74b47d2.zip cpython-01801d1f088ca95c06a976dcd822d390d74b47d2.tar.gz cpython-01801d1f088ca95c06a976dcd822d390d74b47d2.tar.bz2 |
Issue #7403: Fixed possible race condition in lock creation.
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/__init__.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 667a3a5..3f8cf05 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -202,7 +202,10 @@ 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(): """ @@ -210,9 +213,6 @@ def _acquireLock(): This should be released with _releaseLock(). """ - global _lock - if (not _lock) and thread: - _lock = threading.RLock() if _lock: _lock.acquire() |