summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_gc.py
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-02-07 12:38:34 (GMT)
committerGitHub <noreply@github.com>2024-02-07 12:38:34 (GMT)
commit8a3c499ffe7e15297dd4c0b446a0b97b4d32108a (patch)
tree33db486003306c8b0bee15012680642391963977 /Lib/test/test_gc.py
parentd0322fdf2c1a7292a43959fe5a572d783b88a1c4 (diff)
downloadcpython-8a3c499ffe7e15297dd4c0b446a0b97b4d32108a.zip
cpython-8a3c499ffe7e15297dd4c0b446a0b97b4d32108a.tar.gz
cpython-8a3c499ffe7e15297dd4c0b446a0b97b4d32108a.tar.bz2
GH-108362: Revert "GH-108362: Incremental GC implementation (GH-108038)" (#115132)
Revert "GH-108362: Incremental GC implementation (GH-108038)" This reverts commit 36518e69d74607e5f094ce55286188e4545a947d.
Diffstat (limited to 'Lib/test/test_gc.py')
-rw-r--r--Lib/test/test_gc.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index 0002852..b01f344 100644
--- a/Lib/test/test_gc.py
+++ b/Lib/test/test_gc.py
@@ -383,11 +383,19 @@ class GCTests(unittest.TestCase):
# each call to collect(N)
x = []
gc.collect(0)
- # x is now in the old gen
+ # x is now in gen 1
a, b, c = gc.get_count()
- # We don't check a since its exact values depends on
+ gc.collect(1)
+ # x is now in gen 2
+ d, e, f = gc.get_count()
+ gc.collect(2)
+ # x is now in gen 3
+ g, h, i = gc.get_count()
+ # We don't check a, d, g since their exact values depends on
# internal implementation details of the interpreter.
self.assertEqual((b, c), (1, 0))
+ self.assertEqual((e, f), (0, 1))
+ self.assertEqual((h, i), (0, 0))
def test_trashcan(self):
class Ouch:
@@ -838,6 +846,16 @@ class GCTests(unittest.TestCase):
self.assertFalse(
any(l is element for element in gc.get_objects(generation=2))
)
+ gc.collect(generation=1)
+ self.assertFalse(
+ any(l is element for element in gc.get_objects(generation=0))
+ )
+ self.assertFalse(
+ any(l is element for element in gc.get_objects(generation=1))
+ )
+ self.assertTrue(
+ any(l is element for element in gc.get_objects(generation=2))
+ )
gc.collect(generation=2)
self.assertFalse(
any(l is element for element in gc.get_objects(generation=0))