1 2 3 4 5 6 7 8 9 10 11 12
'''Test case for "self.__dict__ = self" circular reference bug (#1469629)''' import gc class LeakyDict(dict): pass def leak(): ld = LeakyDict() ld.__dict__ = ld del ld gc.collect(); gc.collect(); gc.collect()