summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/logging/config.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py
index cc75e94..60744a0 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()