@@ -444,7 +444,7 @@ def __getattr__(self, someattribute):
444
444
# 0, thus mutating the trash graph as a side effect of merely asking
445
445
# whether __del__ exists. This used to (before 2.3b1) crash Python.
446
446
# Now __getattr__ isn't called.
447
- self .assertEqual (gc .collect (), 4 )
447
+ self .assertEqual (gc .collect (), 2 )
448
448
self .assertEqual (len (gc .garbage ), garbagelen )
449
449
450
450
def test_boom2 (self ):
@@ -471,7 +471,7 @@ def __getattr__(self, someattribute):
471
471
# there isn't a second time, so this simply cleans up the trash cycle.
472
472
# We expect a, b, a.__dict__ and b.__dict__ (4 objects) to get
473
473
# reclaimed this way.
474
- self .assertEqual (gc .collect (), 4 )
474
+ self .assertEqual (gc .collect (), 2 )
475
475
self .assertEqual (len (gc .garbage ), garbagelen )
476
476
477
477
def test_boom_new (self ):
@@ -491,7 +491,7 @@ def __getattr__(self, someattribute):
491
491
gc .collect ()
492
492
garbagelen = len (gc .garbage )
493
493
del a , b
494
- self .assertEqual (gc .collect (), 4 )
494
+ self .assertEqual (gc .collect (), 2 )
495
495
self .assertEqual (len (gc .garbage ), garbagelen )
496
496
497
497
def test_boom2_new (self ):
@@ -513,7 +513,7 @@ def __getattr__(self, someattribute):
513
513
gc .collect ()
514
514
garbagelen = len (gc .garbage )
515
515
del a , b
516
- self .assertEqual (gc .collect (), 4 )
516
+ self .assertEqual (gc .collect (), 2 )
517
517
self .assertEqual (len (gc .garbage ), garbagelen )
518
518
519
519
def test_get_referents (self ):
@@ -943,8 +943,8 @@ def getstats():
943
943
A ()
944
944
t = gc .collect ()
945
945
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 )
948
948
self .assertEqual (nc - oldnc , 0 )
949
949
950
950
# But Z() is not actually collected.
@@ -964,8 +964,8 @@ def getstats():
964
964
Z ()
965
965
t = gc .collect ()
966
966
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 )
969
969
self .assertEqual (nc - oldnc , 0 )
970
970
971
971
# The A() trash should have been reclaimed already but the
@@ -974,8 +974,8 @@ def getstats():
974
974
zs .clear ()
975
975
t = gc .collect ()
976
976
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 )
979
979
self .assertEqual (nc - oldnc , 0 )
980
980
981
981
gc .enable ()
@@ -1128,8 +1128,7 @@ def test_collect_generation(self):
1128
1128
@cpython_only
1129
1129
def test_collect_garbage (self ):
1130
1130
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:
1133
1132
Uncollectable ()
1134
1133
Uncollectable ()
1135
1134
C1055820 (666 )
@@ -1138,8 +1137,8 @@ def test_collect_garbage(self):
1138
1137
if v [1 ] != "stop" :
1139
1138
continue
1140
1139
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 )
1143
1142
1144
1143
# We should now have the Uncollectables in gc.garbage
1145
1144
self .assertEqual (len (gc .garbage ), 4 )
@@ -1156,7 +1155,7 @@ def test_collect_garbage(self):
1156
1155
continue
1157
1156
info = v [2 ]
1158
1157
self .assertEqual (info ["collected" ], 0 )
1159
- self .assertEqual (info ["uncollectable" ], 4 )
1158
+ self .assertEqual (info ["uncollectable" ], 2 )
1160
1159
1161
1160
# Uncollectables should be gone
1162
1161
self .assertEqual (len (gc .garbage ), 0 )
0 commit comments