Kaydet (Commit) a1ad3f08 authored tarafından Tim Peters's avatar Tim Peters

And one more simplification to test_saveall().

üst 4803c126
...@@ -174,22 +174,21 @@ def test_saveall(): ...@@ -174,22 +174,21 @@ def test_saveall():
gc.collect() gc.collect()
vereq(gc.garbage, []) # if this fails, someone else created immortal trash vereq(gc.garbage, []) # if this fails, someone else created immortal trash
debug = gc.get_debug()
gc.set_debug(debug | gc.DEBUG_SAVEALL)
l = [] l = []
l.append(l) l.append(l)
id_l = id(l) id_l = id(l)
del l
debug = gc.get_debug()
gc.set_debug(debug | gc.DEBUG_SAVEALL)
del l
gc.collect() gc.collect()
try: gc.set_debug(debug)
vereq(len(gc.garbage), 1)
if id(gc.garbage[0]) == id_l: vereq(len(gc.garbage), 1)
del gc.garbage[0] if id(gc.garbage[0]) == id_l:
else: del gc.garbage[0]
raise TestFailed, "didn't find obj in garbage (saveall)" else:
finally: raise TestFailed, "didn't find obj in garbage (saveall)"
gc.set_debug(debug)
def test_del(): def test_del():
# __del__ methods can trigger collection, make this to happen # __del__ methods can trigger collection, make this to happen
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment