From: Vinay Sajip Date: Sat, 25 Sep 2010 17:48:25 +0000 (+0000) Subject: Issue #9947: logging: Fixed locking bug in stopListening. X-Git-Tag: v2.7.1rc1~240 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3eac591a5c33f4bd0bdd60a76053cd3b6b6e5918;p=python Issue #9947: logging: Fixed locking bug in stopListening. --- diff --git a/Lib/logging/config.py b/Lib/logging/config.py index 356183f5ed..258cc9c31c 100644 --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -895,8 +895,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 e6acb856d9..90a17617fa 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -43,6 +43,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.