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 pablogsal
Recipients Windson Yang, benjamin.peterson, davin, docs@python, mattip, ned.deily, pablogsal, pitrou, tzickel, vstinner, zach.ware
Date 2018-12-03.23:11:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1543878702.44.0.788709270274.issue34172@psf.upfronthosting.co.za>
In-reply-to
Content
> I disagree that a child should keep its parent alive.

But this is normal across the standard library. For example, here is how a deque iterator keeps the deque alive:

>>> x = deque([1,2,3])
>>> deque_iter = iter(x)
>>> deque_weakref = weakref.ref(x)
>>> del x
>>> gc.collect()
>>> gc.get_referrers(deque_weakref())
[<_collections._deque_iterator object at 0x0000024447ED6EA8>]

Here, the deque iterator is the *only* reference to the deque. When we destroy it, the deque is destroyed:
>>> del deque_iter
>>> gc.collect()
>>> deque_weakref()
None
History
Date User Action Args
2018-12-03 23:11:42pablogsalsetrecipients: + pablogsal, pitrou, vstinner, benjamin.peterson, ned.deily, docs@python, zach.ware, mattip, davin, tzickel, Windson Yang
2018-12-03 23:11:42pablogsalsetmessageid: <1543878702.44.0.788709270274.issue34172@psf.upfronthosting.co.za>
2018-12-03 23:11:42pablogsallinkissue34172 messages
2018-12-03 23:11:42pablogsalcreate