From ec1cced4d499fb865ed7960669e2cf0da159ddbe Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Fri, 27 Nov 2009 15:36:32 +0000 Subject: Issue #7403: logging: Fixed possible race condition in lock creation. --- Lib/logging/__init__.py | 8 ++++---- Misc/NEWS | 5 +++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 07f1add..89bb9f2 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -166,7 +166,10 @@ def addLevelName(level, levelName): #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(): """ @@ -174,9 +177,6 @@ def _acquireLock(): This should be released with _releaseLock(). """ - global _lock - if (not _lock) and thread: - _lock = threading.RLock() if _lock: _lock.acquire() diff --git a/Misc/NEWS b/Misc/NEWS index 294c530..f7264af 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -9,6 +9,11 @@ hat's New in Python 2.4.7? *Release date: XX-XXX-2009* +Library +------- + +- Issue #7403: logging: Fixed possible race condition in lock creation. + What's New in Python 2.4.6? =========================== -- cgit v0.12