summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-06-12 14:38:04 +0000
committerGuido van Rossum <guido@python.org>2002-06-12 14:38:04 +0000
commit0ffe36ea5d6a2fbcb31aae2c4bab5cf90fa34854 (patch)
tree474dc7b03962a8ecf70d3f0cde2a4815878e08a1 /Lib
parente17aaff49a3989b752812bda46955aae7e76a216 (diff)
downloadcpython-0ffe36ea5d6a2fbcb31aae2c4bab5cf90fa34854.tar.gz
Add a testcase to ensure that cycles going through the __class__ link
of a new-style instance are detected by the garbage collector.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_gc.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index 22f7e74114..23bb7c5cc9 100644
--- a/Lib/test/test_gc.py
+++ b/Lib/test/test_gc.py
@@ -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.