Cliff Cordeiro added the comment:
It looks like the collector does detect the cycle and that's why it ends up in
garbage with gc.DEBUG_SAVEALL set. Sorry about that.
--
resolution: -> not a bug
stage: -> resolved
status: open -> closed
___
New submission from Cliff Cordeiro :
This class is not collected by the gc without a custom __del__ method to del or
assign None to self.fn:
import gc
class Leak:
def __init__(self):
self.fn = self.x
def x(self):
pass
gc.set_debug(gc.DEBUG_SAVEALL)
l = Leak()
del