Commit 7ccf1b15 authored by Vinay Sajip's avatar Vinay Sajip

Issue #7403: logging: Fixed possible race condition in lock creation.

parent 5a30fa70
...@@ -176,7 +176,10 @@ def addLevelName(level, levelName): ...@@ -176,7 +176,10 @@ def addLevelName(level, levelName):
#the lock would already have been acquired - so we need an RLock. #the lock would already have been acquired - so we need an RLock.
#The same argument applies to Loggers and Manager.loggerDict. #The same argument applies to Loggers and Manager.loggerDict.
# #
_lock = None if thread:
_lock = threading.RLock()
else:
_lock = None
def _acquireLock(): def _acquireLock():
""" """
...@@ -184,9 +187,6 @@ def _acquireLock(): ...@@ -184,9 +187,6 @@ def _acquireLock():
This should be released with _releaseLock(). This should be released with _releaseLock().
""" """
global _lock
if (not _lock) and thread:
_lock = threading.RLock()
if _lock: if _lock:
_lock.acquire() _lock.acquire()
......
...@@ -18,6 +18,8 @@ Core and builtins ...@@ -18,6 +18,8 @@ Core and builtins
Library Library
------- -------
- Issue #7403: logging: Fixed possible race condition in lock creation.
- Issue #5068: Fixed the tarfile._BZ2Proxy.read() method that would loop - Issue #5068: Fixed the tarfile._BZ2Proxy.read() method that would loop
forever on incomplete input. That caused tarfile.open() to hang when used forever on incomplete input. That caused tarfile.open() to hang when used
with mode 'r' or 'r:bz2' and a fileobj argument that contained no data or with mode 'r' or 'r:bz2' and a fileobj argument that contained no data or
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment