Author tim.peters
Recipients Mark.Shannon, christian.heimes, inada.naoki, jdemeyer, lukasz.langa, miss-islington, nascheme, pablogsal, petr.viktorin, pitrou, tim.peters, vstinner
Date 2019-09-28.03:59:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1569643159.39.0.866391792958.issue38006@roundup.psfhosted.org>
In-reply-to
Content
tp_clear implementations are necessary to reclaim trash cycles.  They're always best practice for objects that may be in trash cycles.   tuples are just "cute rebels" that way ;-)

Best guess is that the (some) extension isn't playing by the rules.  A weakref callback shouldn't be called at all unless the weakref is reachable - but in that case the callback function is necessarily reachable too (revealed by a weakrefobject's tp_traverse), so delete_garbage() should never have called clear() on the callback function to begin with.

Note:  I don't believe the weakref design gave any thought to cyclic gc.  The PEP didn't even mention it.  I got dragged into it when Zope started segfaulting.  They don't play well together voluntarily, but they've been forced to coexist, and Zope long ago provoked every fundamental problem I'm aware of.

That "the rules" are subtle doesn't excuse not following them ;-)
History
Date User Action Args
2019-09-28 03:59:19tim.peterssetrecipients: + tim.peters, nascheme, pitrou, vstinner, christian.heimes, petr.viktorin, inada.naoki, lukasz.langa, Mark.Shannon, jdemeyer, pablogsal, miss-islington
2019-09-28 03:59:19tim.peterssetmessageid: <1569643159.39.0.866391792958.issue38006@roundup.psfhosted.org>
2019-09-28 03:59:19tim.peterslinkissue38006 messages
2019-09-28 03:59:19tim.peterscreate