[Python-checkins] cpython (2.7): Issue #12352: In test_free_from_gc(), restore the GC thresholds even if the GC

charles-francois.natali python-checkins at python.org
Sat Jul 2 14:09:48 CEST 2011


http://hg.python.org/cpython/rev/874143242d79
changeset:   71125:874143242d79
branch:      2.7
user:        Charles-François Natali <neologix at free.fr>
date:        Sat Jul 02 14:08:27 2011 +0200
summary:
  Issue #12352: In test_free_from_gc(), restore the GC thresholds even if the GC
wasn't enabled at first.

files:
  Lib/test/test_multiprocessing.py |  7 +++----
  1 files changed, 3 insertions(+), 4 deletions(-)


diff --git a/Lib/test/test_multiprocessing.py b/Lib/test/test_multiprocessing.py
--- a/Lib/test/test_multiprocessing.py
+++ b/Lib/test/test_multiprocessing.py
@@ -1640,12 +1640,11 @@
         # 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

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list