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

This commit is contained in:
Vinay Sajip 2009-11-27 14:03:36 +00:00
parent 608eb2d43d
commit 03f6c11f07
2 changed files with 7 additions and 4 deletions

View File

@ -199,7 +199,11 @@ 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():
"""
@ -207,9 +211,6 @@ def _acquireLock():
This should be released with _releaseLock().
"""
global _lock
if (not _lock) and thread:
_lock = threading.RLock()
if _lock:
_lock.acquire()

View File

@ -140,6 +140,8 @@ C-API
Library
-------
- Issue #7403: logging: Fixed possible race condition in lock creation.
- Issue #6845: Add restart support for binary upload in ftplib. The
`storbinary()` method of FTP and FTP_TLS objects gains an optional `rest`
argument. Patch by Pablo Mouzo.