diff options
| author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2009-11-27 15:34:35 (GMT) |
|---|---|---|
| committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2009-11-27 15:34:35 (GMT) |
| commit | b9c85c156b0b8faf4c090872bed22a868447b785 (patch) | |
| tree | 6505c555a8efe6b376748aa5dc8937fb086f3fc0 | |
| parent | 4c9c260c1a8222d5ecb060e4535910c8cfde0dbd (diff) | |
| download | cpython-b9c85c156b0b8faf4c090872bed22a868447b785.zip cpython-b9c85c156b0b8faf4c090872bed22a868447b785.tar.gz cpython-b9c85c156b0b8faf4c090872bed22a868447b785.tar.bz2 | |
Issue #7403: logging: Fixed possible race condition in lock creation.
| -rw-r--r-- | Lib/logging/__init__.py | 8 | ||||
| -rw-r--r-- | Misc/NEWS | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 39ffae7..7850a16 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -176,7 +176,10 @@ def addLevelName(level, levelName): #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(): """ @@ -184,9 +187,6 @@ def _acquireLock(): This should be released with _releaseLock(). """ - global _lock - if (not _lock) and thread: - _lock = threading.RLock() if _lock: _lock.acquire() @@ -18,6 +18,8 @@ Core and builtins Library ------- +- Issue #7403: logging: Fixed possible race condition in lock creation. + - Issue #5068: Fixed the tarfile._BZ2Proxy.read() method that would loop 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 |
