mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
Issue #7403: Fixed possible race condition in lock creation.
This commit is contained in:
parent
50ea4565bd
commit
01801d1f08
2 changed files with 6 additions and 4 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue