summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lib/logging/config.py10
-rw-r--r--Misc/NEWS2
2 files changed, 8 insertions, 4 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index cc75e94140..60744a0b47 100644
--- a/Lib/logging/config.py
+++ b/Lib/logging/config.py
@@ -917,8 +917,10 @@ def stopListening():
Stop the listening server which was created with a call to listen().
"""
global _listener
- if _listener:
- logging._acquireLock()
- _listener.abort = 1
- _listener = None
+ logging._acquireLock()
+ try:
+ if _listener:
+ _listener.abort = 1
+ _listener = None
+ finally:
logging._releaseLock()
diff --git a/Misc/NEWS b/Misc/NEWS
index c84a8ef3c4..b3af982e78 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -68,6 +68,8 @@ Core and Builtins
Library
-------
+- Issue #9947: logging: Fixed locking bug in stopListening.
+
- Issue #9945: logging: Fixed locking bugs in addHandler/removeHandler.
- Issue #9936: Fixed executable lines' search in the trace module.