mirror of
https://github.com/python/cpython.git
synced 2025-10-03 21:55:41 +00:00
Issue #7403: Fixed possible race condition in lock creation.
This commit is contained in:
parent
546b2121ff
commit
e9c5a0410e
2 changed files with 6 additions and 4 deletions
|
@ -186,7 +186,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():
|
||||||
"""
|
"""
|
||||||
|
@ -194,9 +197,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()
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,8 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #7403: logging: Fixed possible race condition in lock creation.
|
||||||
|
|
||||||
- Issue #7341: Close the internal file object in the TarFile constructor in
|
- Issue #7341: Close the internal file object in the TarFile constructor in
|
||||||
case of an error.
|
case of an error.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue