This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients vstinner
Date 2020-09-22.11:47:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
When debugging race conditions in a multithreaded application with many threads, it's hard to debug when threads have generic names like "Thread-3".

I propose to use the target name in threading.Thread constructor if the name parameter is omitted.

See for example bpo-41739 with "Dangling thread: <Thread(Thread-3, started daemon 4396088817936)>": the "Thread-3" name is not helpful. I suspect that the bug comes from threading.Thread(target=remove_loop, args=(fn, del_count)): with my proposed change, the thread would be called "target=remove_loop", which is more helpful than "Thread".

Fall back on _newname() as usual if target.__name__ attribute does not exist.

Attached PR implements this idea.
Date User Action Args
2020-09-22 11:47:35vstinnersetrecipients: + vstinner
2020-09-22 11:47:35vstinnersetmessageid: <>
2020-09-22 11:47:35vstinnerlinkissue41833 messages
2020-09-22 11:47:35vstinnercreate