@@ -444,7 +444,7 @@ def __getattr__(self, someattribute):
444444 # 0, thus mutating the trash graph as a side effect of merely asking
445445 # whether __del__ exists. This used to (before 2.3b1) crash Python.
446446 # Now __getattr__ isn't called.
447- self .assertEqual (gc .collect (), 4 )
447+ self .assertEqual (gc .collect (), 2 )
448448 self .assertEqual (len (gc .garbage ), garbagelen )
449449
450450 def test_boom2 (self ):
@@ -471,7 +471,7 @@ def __getattr__(self, someattribute):
471471 # there isn't a second time, so this simply cleans up the trash cycle.
472472 # We expect a, b, a.__dict__ and b.__dict__ (4 objects) to get
473473 # reclaimed this way.
474- self .assertEqual (gc .collect (), 4 )
474+ self .assertEqual (gc .collect (), 2 )
475475 self .assertEqual (len (gc .garbage ), garbagelen )
476476
477477 def test_boom_new (self ):
@@ -491,7 +491,7 @@ def __getattr__(self, someattribute):
491491 gc .collect ()
492492 garbagelen = len (gc .garbage )
493493 del a , b
494- self .assertEqual (gc .collect (), 4 )
494+ self .assertEqual (gc .collect (), 2 )
495495 self .assertEqual (len (gc .garbage ), garbagelen )
496496
497497 def test_boom2_new (self ):
@@ -513,7 +513,7 @@ def __getattr__(self, someattribute):
513513 gc .collect ()
514514 garbagelen = len (gc .garbage )
515515 del a , b
516- self .assertEqual (gc .collect (), 4 )
516+ self .assertEqual (gc .collect (), 2 )
517517 self .assertEqual (len (gc .garbage ), garbagelen )
518518
519519 def test_get_referents (self ):
@@ -943,8 +943,8 @@ def getstats():
943943 A ()
944944 t = gc .collect ()
945945 c , nc = getstats ()
946- self .assertEqual (t , 2 * N ) # instance object & its dict
947- self .assertEqual (c - oldc , 2 * N )
946+ self .assertEqual (t , N ) # instance objects
947+ self .assertEqual (c - oldc , N )
948948 self .assertEqual (nc - oldnc , 0 )
949949
950950 # But Z() is not actually collected.
@@ -964,8 +964,8 @@ def getstats():
964964 Z ()
965965 t = gc .collect ()
966966 c , nc = getstats ()
967- self .assertEqual (t , 2 * N )
968- self .assertEqual (c - oldc , 2 * N )
967+ self .assertEqual (t , N )
968+ self .assertEqual (c - oldc , N )
969969 self .assertEqual (nc - oldnc , 0 )
970970
971971 # The A() trash should have been reclaimed already but the
@@ -974,8 +974,8 @@ def getstats():
974974 zs .clear ()
975975 t = gc .collect ()
976976 c , nc = getstats ()
977- self .assertEqual (t , 4 )
978- self .assertEqual (c - oldc , 4 )
977+ self .assertEqual (t , 2 )
978+ self .assertEqual (c - oldc , 2 )
979979 self .assertEqual (nc - oldnc , 0 )
980980
981981 gc .enable ()
@@ -1128,8 +1128,7 @@ def test_collect_generation(self):
11281128 @cpython_only
11291129 def test_collect_garbage (self ):
11301130 self .preclean ()
1131- # Each of these cause four objects to be garbage: Two
1132- # Uncollectables and their instance dicts.
1131+ # Each of these cause two objects to be garbage:
11331132 Uncollectable ()
11341133 Uncollectable ()
11351134 C1055820 (666 )
@@ -1138,8 +1137,8 @@ def test_collect_garbage(self):
11381137 if v [1 ] != "stop" :
11391138 continue
11401139 info = v [2 ]
1141- self .assertEqual (info ["collected" ], 2 )
1142- self .assertEqual (info ["uncollectable" ], 8 )
1140+ self .assertEqual (info ["collected" ], 1 )
1141+ self .assertEqual (info ["uncollectable" ], 4 )
11431142
11441143 # We should now have the Uncollectables in gc.garbage
11451144 self .assertEqual (len (gc .garbage ), 4 )
@@ -1156,7 +1155,7 @@ def test_collect_garbage(self):
11561155 continue
11571156 info = v [2 ]
11581157 self .assertEqual (info ["collected" ], 0 )
1159- self .assertEqual (info ["uncollectable" ], 4 )
1158+ self .assertEqual (info ["uncollectable" ], 2 )
11601159
11611160 # Uncollectables should be gone
11621161 self .assertEqual (len (gc .garbage ), 0 )
0 commit comments