[Python-Dev] Bizarre new test failure
Tim Peters
tim.one@comcast.net
Thu, 06 Jun 2002 20:48:53 -0400
Guido noticed this on Linux late this afternoon. I've seen it on Win2K and
Win98SE since. test_gc fails if you run the whole test suite from the
start:
test test_gc failed -- test_list: actual 10, expected 1
This seems impossible (look at the test). It doesn't fail in isolation. It
fails in both debug and release builds. Not *all* tests before test_gc need
to be run in order to provoke a failure, but I can detect no sense in which
do need to be run (not just one or two, but lots of them).
Here are the files that changed between a Python that does work (yesterday)
and now:
P python/configure
P python/configure.in
P python/pyconfig.h.in
P python/Doc/lib/libgetopt.tex
P python/Doc/lib/libsocket.tex
P python/Lib/copy.py
P python/Lib/fileinput.py
P python/Lib/getopt.py
P python/Lib/posixpath.py
P python/Lib/shutil.py
P python/Lib/socket.py
P python/Lib/compiler/pyassem.py
P python/Lib/compiler/pycodegen.py
P python/Lib/compiler/transformer.py
P python/Lib/distutils/command/clean.py
P python/Lib/test/test_b1.py
P python/Lib/test/test_commands.py
P python/Lib/test/test_descr.py
P python/Lib/test/test_getopt.py
P python/Lib/test/test_socket.py
U python/Lib/test/test_timeout.py
P python/Misc/ACKS
P python/Misc/NEWS
P python/Modules/gcmodule.c
P python/Modules/socketmodule.c
P python/Modules/socketmodule.h
P python/Objects/abstract.c
P python/Objects/complexobject.c
P python/Objects/rangeobject.c
P python/Tools/webchecker/webchecker.py
While Jeremy did fiddle gcmodule.c, that isn't the cause.
I changed the test like so:
def test_list():
import sys
l = []
l.append(l)
gc.collect()
del l
gc.set_debug(gc.DEBUG_SAVEALL)
n = gc.collect()
print >> sys.stderr, '*' * 30, n, gc.garbage
expect(n, 1, "list")
Here's the list of garbage objects it found:
[<class 'test_descr.mysuper'>,
{'__dict__': <attribute '__dict__' of 'mysuper' objects>,
'__module__': 'test_descr',
'__weakref__': <member '__weakref__' of 'mysuper' objects>,
'__doc__': None,
'__init__': <function __init__ at 0x00CC00D8>},
(<class 'test_descr.mysuper'>, <type 'super'>, <type 'object'>),
(<type 'super'>,),
[[...]],
<attribute '__dict__' of 'mysuper' objects>,
<member '__weakref__' of 'mysuper' objects>,
<function __init__ at 0x00CC00D8>,
(<cell at 0x00CB4DB0: type object at 0x00768420>,),
<cell at 0x00CB4DB0: type object at 0x00768420>]
The recursive list:
[[...]]
is the only one expected here.
Your turn <wink>.