bpo-25130: Add calls of gc.collect() in tests to support PyPy (GH-28005) · python/cpython@2a8127c (original) (raw)
`@@ -656,6 +656,7 @@ def inner_raising_func():
`
656
656
`except MyException as e:
`
657
657
`pass
`
658
658
`obj = None
`
``
659
`+
gc_collect() # For PyPy or other GCs.
`
659
660
`obj = wr()
`
660
661
`self.assertIsNone(obj)
`
661
662
``
`@@ -667,6 +668,7 @@ def inner_raising_func():
`
667
668
`except MyException:
`
668
669
`pass
`
669
670
`obj = None
`
``
671
`+
gc_collect() # For PyPy or other GCs.
`
670
672
`obj = wr()
`
671
673
`self.assertIsNone(obj)
`
672
674
``
`@@ -678,6 +680,7 @@ def inner_raising_func():
`
678
680
`except:
`
679
681
`pass
`
680
682
`obj = None
`
``
683
`+
gc_collect() # For PyPy or other GCs.
`
681
684
`obj = wr()
`
682
685
`self.assertIsNone(obj)
`
683
686
``
`@@ -690,6 +693,7 @@ def inner_raising_func():
`
690
693
`except:
`
691
694
`break
`
692
695
`obj = None
`
``
696
`+
gc_collect() # For PyPy or other GCs.
`
693
697
`obj = wr()
`
694
698
`self.assertIsNone(obj)
`
695
699
``
`@@ -708,6 +712,7 @@ def inner_raising_func():
`
708
712
`# must clear the latter manually for our test to succeed.
`
709
713
`e.context = None
`
710
714
`obj = None
`
``
715
`+
gc_collect() # For PyPy or other GCs.
`
711
716
`obj = wr()
`
712
717
`# guarantee no ref cycles on CPython (don't gc_collect)
`
713
718
`if check_impl_detail(cpython=False):
`
`@@ -898,6 +903,7 @@ def raising_gen():
`
898
903
`next(g)
`
899
904
`testfunc(g)
`
900
905
`g = obj = None
`
``
906
`+
gc_collect() # For PyPy or other GCs.
`
901
907
`obj = wr()
`
902
908
`self.assertIsNone(obj)
`
903
909
``
`@@ -951,6 +957,7 @@ def del(self):
`
951
957
`raise Exception(MyObject())
`
952
958
`except:
`
953
959
`pass
`
``
960
`+
gc_collect() # For PyPy or other GCs.
`
954
961
`self.assertEqual(e, (None, None, None))
`
955
962
``
956
963
`def test_raise_does_not_create_context_chain_cycle(self):
`
`@@ -1413,6 +1420,7 @@ def inner():
`
1413
1420
`self.assertNotEqual(wr(), None)
`
1414
1421
`else:
`
1415
1422
`self.fail("MemoryError not raised")
`
``
1423
`+
gc_collect() # For PyPy or other GCs.
`
1416
1424
`self.assertEqual(wr(), None)
`
1417
1425
``
1418
1426
`@no_tracing
`
`@@ -1433,6 +1441,7 @@ def inner():
`
1433
1441
`self.assertNotEqual(wr(), None)
`
1434
1442
`else:
`
1435
1443
`self.fail("RecursionError not raised")
`
``
1444
`+
gc_collect() # For PyPy or other GCs.
`
1436
1445
`self.assertEqual(wr(), None)
`
1437
1446
``
1438
1447
`def test_errno_ENOTDIR(self):
`
`@@ -1453,6 +1462,7 @@ def del(self):
`
1453
1462
`with support.catch_unraisable_exception() as cm:
`
1454
1463
`del obj
`
1455
1464
``
``
1465
`+
gc_collect() # For PyPy or other GCs.
`
1456
1466
`self.assertEqual(cm.unraisable.object, BrokenDel.del)
`
1457
1467
`self.assertIsNotNone(cm.unraisable.exc_traceback)
`
1458
1468
``