summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2024-01-30 12:34:18 (GMT)
committerGitHub <noreply@github.com>2024-01-30 12:34:18 (GMT)
commite21754d7f8336d4647e28f355d8a3dbd5a2c7545 (patch)
treeb56616d31c06ca9cfc54bcc72c3d6519a70e7e34 /Lib/logging
parentea30a28c3e89b69a214c536e61402660242c0f2a (diff)
downloadcpython-e21754d7f8336d4647e28f355d8a3dbd5a2c7545.zip
cpython-e21754d7f8336d4647e28f355d8a3dbd5a2c7545.tar.gz
cpython-e21754d7f8336d4647e28f355d8a3dbd5a2c7545.tar.bz2
gh-114706: Allow QueueListener.stop() to be called more than once. (GH-114748)
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/handlers.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 9840b7b..e7f1322 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -1586,6 +1586,7 @@ class QueueListener(object):
Note that if you don't call this before your application exits, there
may be some records still left on the queue, which won't be processed.
"""
- self.enqueue_sentinel()
- self._thread.join()
- self._thread = None
+ if self._thread: # see gh-114706 - allow calling this more than once
+ self.enqueue_sentinel()
+ self._thread.join()
+ self._thread = None