Skip to content

Remove DummyThread from threading._active when thread dies #114423

Closed
@fabioz

Description

@fabioz

Feature or enhancement

Proposal:

This has bothered me quite a bit already: If some code calls threading.current_thread() in a thread that’s not created from the threading module it lingers at threading._active forever (or until another thread with the same thread.ident is created, which isn’t that uncommon).

My suggestion would be to remove it when the thread dies.

I'll provide a PR.

Has this already been discussed elsewhere?

I have already discussed this feature proposal on Discourse

Links to previous discussion of this feature:

https://discuss.python.org/t/remove-dummythread-from-threading-active-when-thread-dies/41322

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions