mirror of
https://github.com/python/cpython.git
synced 2025-11-04 03:44:55 +00:00
Issue #7403: Fixed possible race condition in lock creation.
This commit is contained in:
parent
608eb2d43d
commit
03f6c11f07
2 changed files with 7 additions and 4 deletions
|
|
@ -199,17 +199,18 @@ def _checkLevel(level):
|
||||||
#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.
|
||||||
#
|
#
|
||||||
|
if thread:
|
||||||
|
_lock = threading.RLock()
|
||||||
|
else:
|
||||||
_lock = None
|
_lock = None
|
||||||
|
|
||||||
|
|
||||||
def _acquireLock():
|
def _acquireLock():
|
||||||
"""
|
"""
|
||||||
Acquire the module-level lock for serializing access to shared data.
|
Acquire the module-level lock for serializing access to shared data.
|
||||||
|
|
||||||
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()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,8 @@ C-API
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #7403: logging: Fixed possible race condition in lock creation.
|
||||||
|
|
||||||
- Issue #6845: Add restart support for binary upload in ftplib. The
|
- Issue #6845: Add restart support for binary upload in ftplib. The
|
||||||
`storbinary()` method of FTP and FTP_TLS objects gains an optional `rest`
|
`storbinary()` method of FTP and FTP_TLS objects gains an optional `rest`
|
||||||
argument. Patch by Pablo Mouzo.
|
argument. Patch by Pablo Mouzo.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue