mirror of
https://github.com/python/cpython.git
synced 2026-05-16 15:30:48 +00:00
[3.14] gh-139951: Test on GC collection disabled if threshold is zero (GH-140304) (#140362)
gh-139951: Test on GC collection disabled if threshold is zero (GH-140304)
(cherry picked from commit 5d0abb6971)
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
This commit is contained in:
parent
d7dc6bfe2f
commit
3d4cf3bda3
1 changed files with 14 additions and 0 deletions
|
|
@ -1501,6 +1501,20 @@ def test_indirect_calls_with_gc_disabled(self):
|
|||
finally:
|
||||
gc.enable()
|
||||
|
||||
# Ensure that setting *threshold0* to zero disables collection.
|
||||
@gc_threshold(0)
|
||||
def test_threshold_zero(self):
|
||||
junk = []
|
||||
i = 0
|
||||
detector = GC_Detector()
|
||||
while not detector.gc_happened:
|
||||
i += 1
|
||||
if i > 50000:
|
||||
break
|
||||
junk.append([]) # this may eventually trigger gc (if it is enabled)
|
||||
|
||||
self.assertEqual(i, 50001)
|
||||
|
||||
|
||||
class PythonFinalizationTests(unittest.TestCase):
|
||||
def test_ast_fini(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue