[Python-checkins] cpython (3.2): don't gc_collect on CPython to guarantee a lack of ref cycles (thanks Antoine)

philip.jenvey python-checkins at python.org
Wed Nov 14 23:50:07 CET 2012


http://hg.python.org/cpython/rev/dd60de9d8dd6
changeset:   80436:dd60de9d8dd6
branch:      3.2
parent:      80431:2d266ce80712
user:        Philip Jenvey <pjenvey at underboss.org>
date:        Wed Nov 14 14:37:24 2012 -0800
summary:
  don't gc_collect on CPython to guarantee a lack of ref cycles (thanks Antoine)

files:
  Lib/test/test_exceptions.py |  14 +++++++++-----
  1 files changed, 9 insertions(+), 5 deletions(-)


diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -7,8 +7,8 @@
 import weakref
 import errno
 
-from test.support import (TESTFN, unlink, run_unittest, captured_output,
-                          gc_collect, cpython_only)
+from test.support import (TESTFN, captured_output, check_impl_detail,
+                          cpython_only, gc_collect, run_unittest, unlink)
 
 # XXX This is not really enough, each *operation* should be tested!
 
@@ -493,7 +493,9 @@
             e.__context__ = None
             obj = None
             obj = wr()
-            gc_collect()
+            # guarantee no ref cycles on CPython (don't gc_collect)
+            if check_impl_detail(cpython=False):
+                gc_collect()
             self.assertTrue(obj is None, "%s" % obj)
 
         # Some complicated construct
@@ -510,7 +512,8 @@
             except MyException:
                 pass
         obj = None
-        gc_collect()
+        if check_impl_detail(cpython=False):
+            gc_collect()
         obj = wr()
         self.assertTrue(obj is None, "%s" % obj)
 
@@ -525,7 +528,8 @@
         with Context():
             inner_raising_func()
         obj = None
-        gc_collect()
+        if check_impl_detail(cpython=False):
+            gc_collect()
         obj = wr()
         self.assertTrue(obj is None, "%s" % obj)
 

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


More information about the Python-checkins mailing list