mirror of
https://github.com/python/cpython.git
synced 2025-10-01 21:02:15 +00:00
Issue #9945: logging: Fixed locking bugs in addHandler/removeHandler.
This commit is contained in:
parent
7db964d5aa
commit
546885ea4e
2 changed files with 13 additions and 8 deletions
|
@ -1263,20 +1263,23 @@ class Logger(Filterer):
|
||||||
"""
|
"""
|
||||||
Add the specified handler to this logger.
|
Add the specified handler to this logger.
|
||||||
"""
|
"""
|
||||||
|
_acquireLock()
|
||||||
|
try:
|
||||||
if not (hdlr in self.handlers):
|
if not (hdlr in self.handlers):
|
||||||
self.handlers.append(hdlr)
|
self.handlers.append(hdlr)
|
||||||
|
finally:
|
||||||
|
_releaseLock()
|
||||||
|
|
||||||
def removeHandler(self, hdlr):
|
def removeHandler(self, hdlr):
|
||||||
"""
|
"""
|
||||||
Remove the specified handler from this logger.
|
Remove the specified handler from this logger.
|
||||||
"""
|
"""
|
||||||
if hdlr in self.handlers:
|
_acquireLock()
|
||||||
#hdlr.close()
|
|
||||||
hdlr.acquire()
|
|
||||||
try:
|
try:
|
||||||
|
if hdlr in self.handlers:
|
||||||
self.handlers.remove(hdlr)
|
self.handlers.remove(hdlr)
|
||||||
finally:
|
finally:
|
||||||
hdlr.release()
|
_releaseLock()
|
||||||
|
|
||||||
def callHandlers(self, record):
|
def callHandlers(self, record):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -43,6 +43,8 @@ Core and Builtins
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Issue #9945: logging: Fixed locking bugs in addHandler/removeHandler.
|
||||||
|
|
||||||
- Issue #9936: Fixed executable lines' search in the trace module.
|
- Issue #9936: Fixed executable lines' search in the trace module.
|
||||||
|
|
||||||
- Issue #9928: Properly initialize the types exported by the bz2 module.
|
- Issue #9928: Properly initialize the types exported by the bz2 module.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue