Commit b37ac8ea authored by Philip Jenvey's avatar Philip Jenvey

don't gc_collect on CPython to guarantee a lack of ref cycles (thanks Antoine)

parent f9e49eae
...@@ -7,8 +7,8 @@ import pickle ...@@ -7,8 +7,8 @@ import pickle
import weakref import weakref
import errno import errno
from test.support import (TESTFN, unlink, run_unittest, captured_output, from test.support import (TESTFN, captured_output, check_impl_detail,
gc_collect, cpython_only) cpython_only, gc_collect, run_unittest, unlink)
# XXX This is not really enough, each *operation* should be tested! # XXX This is not really enough, each *operation* should be tested!
...@@ -493,6 +493,8 @@ class ExceptionTests(unittest.TestCase): ...@@ -493,6 +493,8 @@ class ExceptionTests(unittest.TestCase):
e.__context__ = None e.__context__ = None
obj = None obj = None
obj = wr() obj = wr()
# guarantee no ref cycles on CPython (don't gc_collect)
if check_impl_detail(cpython=False):
gc_collect() gc_collect()
self.assertTrue(obj is None, "%s" % obj) self.assertTrue(obj is None, "%s" % obj)
...@@ -510,6 +512,7 @@ class ExceptionTests(unittest.TestCase): ...@@ -510,6 +512,7 @@ class ExceptionTests(unittest.TestCase):
except MyException: except MyException:
pass pass
obj = None obj = None
if check_impl_detail(cpython=False):
gc_collect() gc_collect()
obj = wr() obj = wr()
self.assertTrue(obj is None, "%s" % obj) self.assertTrue(obj is None, "%s" % obj)
...@@ -525,6 +528,7 @@ class ExceptionTests(unittest.TestCase): ...@@ -525,6 +528,7 @@ class ExceptionTests(unittest.TestCase):
with Context(): with Context():
inner_raising_func() inner_raising_func()
obj = None obj = None
if check_impl_detail(cpython=False):
gc_collect() gc_collect()
obj = wr() obj = wr()
self.assertTrue(obj is None, "%s" % obj) self.assertTrue(obj is None, "%s" % obj)
......
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