Skip to content

Commit 5b1f721

Browse files
Test added
1 parent d86ad87 commit 5b1f721

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Lib/test/test_gc.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,20 @@ def test_indirect_calls_with_gc_disabled(self):
15591559
finally:
15601560
gc.enable()
15611561

1562+
# Ensure that setting *threshold0* to zero disables collection.
1563+
@gc_threshold(0, 0, 0)
1564+
def test_threshold_zero(self):
1565+
junk = []
1566+
i = 0
1567+
detector = GC_Detector()
1568+
while not detector.gc_happened:
1569+
i += 1
1570+
if i > 50000:
1571+
break
1572+
junk.append([]) # this may eventually trigger gc (if it is enabled)
1573+
1574+
self.assertEqual(i, 50001)
1575+
15621576

15631577
class PythonFinalizationTests(unittest.TestCase):
15641578
def test_ast_fini(self):

0 commit comments

Comments
 (0)