Commit 0ffe36ea authored by Guido van Rossum's avatar Guido van Rossum

Add a testcase to ensure that cycles going through the __class__ link

of a new-style instance are detected by the garbage collector.
parent e17aaff4
......@@ -83,6 +83,12 @@ def test_newinstance():
gc.collect()
del a
expect_nonzero(gc.collect(), "newinstance(2)")
del B, C
expect_nonzero(gc.collect(), "newinstance(3)")
A.a = A()
del A
expect_nonzero(gc.collect(), "newinstance(4)")
expect(gc.collect(), 0, "newinstance(5)")
def test_method():
# Tricky: self.__init__ is a bound method, it references the instance.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment