summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_gc.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index db7cb9ac..81bb5bb 100644
--- a/Lib/test/test_gc.py
+++ b/Lib/test/test_gc.py
@@ -1387,6 +1387,31 @@ class GCTogglingTests(unittest.TestCase):
# empty __dict__.
self.assertEqual(x, None)
+ def test_indirect_calls_with_gc_disabled(self):
+ junk = []
+ i = 0
+ detector = GC_Detector()
+ while not detector.gc_happened:
+ i += 1
+ if i > 10000:
+ self.fail("gc didn't happen after 10000 iterations")
+ junk.append([]) # this will eventually trigger gc
+
+ try:
+ gc.disable()
+ junk = []
+ i = 0
+ detector = GC_Detector()
+ while not detector.gc_happened:
+ i += 1
+ if i > 10000:
+ break
+ junk.append([]) # this may eventually trigger gc (if it is enabled)
+
+ self.assertEqual(i, 10001)
+ finally:
+ gc.enable()
+
class PythonFinalizationTests(unittest.TestCase):
def test_ast_fini(self):