New submission from STINNER Victor <vstin...@python.org>:
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. ---------- components: Library (Lib) messages: 377314 nosy: vstinner priority: normal severity: normal status: open title: threading.Thread: use target name if the name parameter is omitted versions: Python 3.10 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue41833> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com