"""Test for process-exit garbage collection fails with Python 3.4.0 """ import time class Child: def __init__(self, parent): self.parent = parent parent.children += 1 def __del__(self): print("del child") self.parent.children -= 1 class Parent: def __init__(self): self.children = 0 def child(self): return Child(self) def __del__(self): print("del parent") while self.children: print("parent still has %i children" % self.children) time.sleep(0.25) print("parent deleted") p = Parent() c = p.child() c2 = p.child()