mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue #9945: logging: Fixed locking bugs in addHandler/removeHandler.
This commit is contained in:
parent
fda2106ac2
commit
32fb6a81f9
2 changed files with 13 additions and 7 deletions
|
@ -1226,19 +1226,23 @@ class Logger(Filterer):
|
|||
"""
|
||||
Add the specified handler to this logger.
|
||||
"""
|
||||
if not (hdlr in self.handlers):
|
||||
self.handlers.append(hdlr)
|
||||
_acquireLock()
|
||||
try:
|
||||
if not (hdlr in self.handlers):
|
||||
self.handlers.append(hdlr)
|
||||
finally:
|
||||
_releaseLock()
|
||||
|
||||
def removeHandler(self, hdlr):
|
||||
"""
|
||||
Remove the specified handler from this logger.
|
||||
"""
|
||||
if hdlr in self.handlers:
|
||||
hdlr.acquire()
|
||||
try:
|
||||
_acquireLock()
|
||||
try:
|
||||
if hdlr in self.handlers:
|
||||
self.handlers.remove(hdlr)
|
||||
finally:
|
||||
hdlr.release()
|
||||
finally:
|
||||
_releaseLock()
|
||||
|
||||
def hasHandlers(self):
|
||||
"""
|
||||
|
|
|
@ -68,6 +68,8 @@ Core and Builtins
|
|||
Library
|
||||
-------
|
||||
|
||||
- Issue #9945: logging: Fixed locking bugs in addHandler/removeHandler.
|
||||
|
||||
- Issue #9936: Fixed executable lines' search in the trace module.
|
||||
|
||||
- Issue #9790: Rework imports necessary for samefile and sameopenfile
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue