From 1e67d78b0a2b4b7e09e7bad2b911c60d1b6bf4d6 Mon Sep 17 00:00:00 2001 From: slateny <46876382+slateny@users.noreply.github.com> Date: Tue, 12 Jul 2022 23:02:04 -0700 Subject: [PATCH 1/2] Clarify wording on daemon threads --- Doc/library/threading.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index 58e4ad786fe17f..dbe9bd251b0b04 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -274,8 +274,10 @@ If the :meth:`~Thread.run` method raises an exception, :func:`threading.excepthook` is called to handle it. By default, :func:`threading.excepthook` ignores silently :exc:`SystemExit`. -A thread can be flagged as a "daemon thread". The significance of this flag is -that the entire Python program exits when only daemon threads are left. The +A thread can be flagged as a "daemon thread". A thread with this flag is shut +down when the main thread and all others non-daemon threads end. +This means a Python program runs as long as non-daemon threads (such as the main +thread) are running, and exits when only daemon threads are left. The initial value is inherited from the creating thread. The flag can be set through the :attr:`~Thread.daemon` property or the *daemon* constructor argument. From 6f3d2da05c3c14c366d01dcddbde16b9b6cd7204 Mon Sep 17 00:00:00 2001 From: Stanley <46876382+slateny@users.noreply.github.com> Date: Wed, 20 Aug 2025 10:45:24 -0400 Subject: [PATCH 2/2] others -> other Co-authored-by: AN Long --- Doc/library/threading.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/threading.rst b/Doc/library/threading.rst index 95d4ad4bcc838f..6145562bb73261 100644 --- a/Doc/library/threading.rst +++ b/Doc/library/threading.rst @@ -311,7 +311,7 @@ If the :meth:`~Thread.run` method raises an exception, :func:`threading.excepthook` ignores silently :exc:`SystemExit`. A thread can be flagged as a "daemon thread". A thread with this flag is shut -down when the main thread and all others non-daemon threads end. +down when the main thread and all other non-daemon threads end. This means a Python program runs as long as non-daemon threads (such as the main thread) are running, and exits when only daemon threads are left. The initial value is inherited from the creating thread. The flag can be set