mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
test_saveall(): Simplified a little, given that we only expect one item
in gc.garbage (so no need to loop looking for it -- it's there or it's not).
This commit is contained in:
parent
c708c0a8c4
commit
4803c126a6
1 changed files with 4 additions and 6 deletions
|
|
@ -180,16 +180,14 @@ def test_saveall():
|
|||
l.append(l)
|
||||
id_l = id(l)
|
||||
del l
|
||||
|
||||
gc.collect()
|
||||
vereq(len(gc.garbage), 1)
|
||||
try:
|
||||
for obj in gc.garbage:
|
||||
if id(obj) == id_l:
|
||||
del obj[:]
|
||||
break
|
||||
vereq(len(gc.garbage), 1)
|
||||
if id(gc.garbage[0]) == id_l:
|
||||
del gc.garbage[0]
|
||||
else:
|
||||
raise TestFailed, "didn't find obj in garbage (saveall)"
|
||||
gc.garbage.remove(obj)
|
||||
finally:
|
||||
gc.set_debug(debug)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue