summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-08-10 21:32:16 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-08-10 21:32:16 (GMT)
commita1ad3f08ad1ce102636e75782d31d4f3cd7893a7 (patch)
treec664bfa5580921f00d370308f0fd12317c89eed5 /Lib/test
parent4803c126a683b54622e49d996b1a56993a68b6f3 (diff)
downloadcpython-a1ad3f08ad1ce102636e75782d31d4f3cd7893a7.zip
cpython-a1ad3f08ad1ce102636e75782d31d4f3cd7893a7.tar.gz
cpython-a1ad3f08ad1ce102636e75782d31d4f3cd7893a7.tar.bz2
And one more simplification to test_saveall().
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_gc.py21
1 files changed, 10 insertions, 11 deletions
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index 2e1bc11..1e684bf 100644
--- a/Lib/test/test_gc.py
+++ b/Lib/test/test_gc.py
@@ -174,22 +174,21 @@ def test_saveall():
gc.collect()
vereq(gc.garbage, []) # if this fails, someone else created immortal trash
- debug = gc.get_debug()
- gc.set_debug(debug | gc.DEBUG_SAVEALL)
l = []
l.append(l)
id_l = id(l)
- del l
+ debug = gc.get_debug()
+ gc.set_debug(debug | gc.DEBUG_SAVEALL)
+ del l
gc.collect()
- try:
- 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)"
- finally:
- gc.set_debug(debug)
+ gc.set_debug(debug)
+
+ 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)"
def test_del():
# __del__ methods can trigger collection, make this to happen