Message323103
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. |
|
Date |
User |
Action |
Args |
2018-08-04 13:10:34 | tzickel | set | recipients:
+ tzickel, pitrou, docs@python, zach.ware, mattip, davin, Windson Yang |
2018-08-04 13:10:34 | tzickel | set | messageid: <1533388234.49.0.56676864532.issue34172@psf.upfronthosting.co.za> |
2018-08-04 13:10:34 | tzickel | link | issue34172 messages |
2018-08-04 13:10:34 | tzickel | create | |
|