Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9fdd11b

Browse files
committed
Issue #9947: logging: Fixed locking bug in stopListening.
1 parent 32fb6a8 commit 9fdd11b

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

Lib/logging/config.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,10 @@ def stopListening():
917917
Stop the listening server which was created with a call to listen().
918918
"""
919919
global _listener
920-
if _listener:
921-
logging._acquireLock()
922-
_listener.abort = 1
923-
_listener = None
920+
logging._acquireLock()
921+
try:
922+
if _listener:
923+
_listener.abort = 1
924+
_listener = None
925+
finally:
924926
logging._releaseLock()

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ Core and Builtins
6868
Library
6969
-------
7070

71+
- Issue #9947: logging: Fixed locking bug in stopListening.
72+
7173
- Issue #9945: logging: Fixed locking bugs in addHandler/removeHandler.
7274

7375
- Issue #9936: Fixed executable lines' search in the trace module.

0 commit comments

Comments
 (0)