summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-08-10 21:20:54 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-08-10 21:20:54 (GMT)
commitc708c0a8c41de2c14587d8683c6b6a91d06c97bf (patch)
tree83ab13297ad15355228e0dee20574daa3c473347 /Lib/test
parent75ea1e11dcb90c768af6a222ae8e20a4f532617d (diff)
downloadcpython-c708c0a8c41de2c14587d8683c6b6a91d06c97bf.zip
cpython-c708c0a8c41de2c14587d8683c6b6a91d06c97bf.tar.gz
cpython-c708c0a8c41de2c14587d8683c6b6a91d06c97bf.tar.bz2
If any trash happened to be sitting around waiting to get collected at
the time it's called, test_saveall() made it look a leak, triggering bogus warnings from regrtest's -l (findleaks) mode.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_gc.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py
index 8c79ac6..46448ba 100644
--- a/Lib/test/test_gc.py
+++ b/Lib/test/test_gc.py
@@ -1,4 +1,4 @@
-from test.test_support import verify, verbose, TestFailed
+from test.test_support import verify, verbose, TestFailed, vereq
import sys
import gc
@@ -168,6 +168,12 @@ def test_frame():
def test_saveall():
# Verify that cyclic garbage like lists show up in gc.garbage if the
# SAVEALL option is enabled.
+
+ # First make sure we don't save away other stuff that just happens to
+ # be waiting for collection.
+ 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 = []
@@ -175,6 +181,7 @@ def test_saveall():
id_l = id(l)
del l
gc.collect()
+ vereq(len(gc.garbage), 1)
try:
for obj in gc.garbage:
if id(obj) == id_l: