]> granicus.if.org Git - python/commitdiff
Issue #12352: In test_free_from_gc(), restore the GC thresholds even if the GC
authorCharles-François Natali <neologix@free.fr>
Sat, 2 Jul 2011 12:08:27 +0000 (14:08 +0200)
committerCharles-François Natali <neologix@free.fr>
Sat, 2 Jul 2011 12:08:27 +0000 (14:08 +0200)
wasn't enabled at first.

Lib/test/test_multiprocessing.py

index 18a2f29f0ae223dc54c17c3326c1c03e1c3fe29f..6da4b177727f73689dd01cdd3be4fb9cd82c6e4a 100644 (file)
@@ -1640,12 +1640,11 @@ class _TestHeap(BaseTestCase):
         # Make sure the GC is enabled, and set lower collection thresholds to
         # make collections more frequent (and increase the probability of
         # deadlock).
-        if gc.isenabled():
-            thresholds = gc.get_threshold()
-            self.addCleanup(gc.set_threshold, *thresholds)
-        else:
+        if not gc.isenabled():
             gc.enable()
             self.addCleanup(gc.disable)
+        thresholds = gc.get_threshold()
+        self.addCleanup(gc.set_threshold, *thresholds)
         gc.set_threshold(10)
 
         # perform numerous block allocations, with cyclic references to make