Skip to content

Docs: threading says dummy thread objects are never deleted, outdated since 3.13 #159011

Description

@ArtVsMark

Documentation

Doc/library/threading.rst says about dummy thread objects:

They are never deleted, since it is impossible to detect the termination of alien threads.

Since 3.13, Lib/threading.py does detect it: _DeleteDummyThreadOnDel is stored
in a thread-local (_thread_local_info). When the alien thread finishes, the
object is collected and removes the dummy thread from threading._active.

import _thread, threading, time
done = threading.Event()
def f():
    threading.current_thread()   # creates a _DummyThread
    done.set()
_thread.start_new_thread(f, ())
done.wait(); time.sleep(0.3)
print([t.name for t in threading.enumerate()])
Version Output
3.12 ['MainThread', 'Dummy-1']
3.13 / 3.14 / 3.15 ['MainThread']

Suggested fix: drop "They are never deleted…" and say that since 3.13 a dummy
thread object is removed once the alien thread finishes. Add a versionchanged:: 3.13 note.


Linked PRs

Activity

  1. nightcityblade commented on Oct 8, 2026

    @nightcityblade

    Hi, I would like to work on this documentation update. I will submit a focused PR shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions