Kaydet (Commit) 7c20ad32 authored tarafından Charles-François Natali's avatar Charles-François Natali

Issue #12352: In test_free_from_gc(), restore the GC thresholds even if the GC

wasn't enabled at first.
üst 414d0fae
...@@ -1640,12 +1640,11 @@ class _TestHeap(BaseTestCase): ...@@ -1640,12 +1640,11 @@ class _TestHeap(BaseTestCase):
# Make sure the GC is enabled, and set lower collection thresholds to # Make sure the GC is enabled, and set lower collection thresholds to
# make collections more frequent (and increase the probability of # make collections more frequent (and increase the probability of
# deadlock). # deadlock).
if gc.isenabled(): if not gc.isenabled():
thresholds = gc.get_threshold()
self.addCleanup(gc.set_threshold, *thresholds)
else:
gc.enable() gc.enable()
self.addCleanup(gc.disable) self.addCleanup(gc.disable)
thresholds = gc.get_threshold()
self.addCleanup(gc.set_threshold, *thresholds)
gc.set_threshold(10) gc.set_threshold(10)
# perform numerous block allocations, with cyclic references to make # perform numerous block allocations, with cyclic references to make
......
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