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 tzickel
Recipients Windson Yang, davin, docs@python, mattip, pitrou, tzickel, zach.ware
Date 2018-08-04.13:10:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1533388234.49.0.56676864532.issue34172@psf.upfronthosting.co.za>
In-reply-to
Content
It actually makes tons of sense that while the thread is running, that the object representing it is alive. After the thread finishes its work, the object dies.

>>> import time, threading, weakref, gc
>>> t = threading.Thread(target=time.sleep, args=(10,))
>>> wr = weakref.ref(t)
>>> t.start()
>>> del t
>>> gc.collect()
>>> wr()
<Thread(Thread-1, started 139937234327296)>
Wait 10 seconds...
>>> gc.collect()
>>> wr()

The thread is gone (which doesn't happen with the pool).

Anyhow, I've submitted a patch to fix the bug that was introduced 9 years ago on GH, feel free to check it.
History
Date User Action Args
2018-08-04 13:10:34tzickelsetrecipients: + tzickel, pitrou, docs@python, zach.ware, mattip, davin, Windson Yang
2018-08-04 13:10:34tzickelsetmessageid: <1533388234.49.0.56676864532.issue34172@psf.upfronthosting.co.za>
2018-08-04 13:10:34tzickellinkissue34172 messages
2018-08-04 13:10:34tzickelcreate