From: Vinay Sajip Date: Fri, 27 Nov 2009 15:36:32 +0000 (+0000) Subject: Issue #7403: logging: Fixed possible race condition in lock creation. X-Git-Tag: 2.4~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ec1cced4d499fb865ed7960669e2cf0da159ddbe;p=thirdparty%2FPython%2Fcpython.git Issue #7403: logging: Fixed possible race condition in lock creation. --- diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 07f1add37ace..89bb9f2bbeee 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 294c53058db7..f7264af721dc 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? ===========================