[Python-Dev] Re: various test failures - test_site, test_tempfile, test_bsddb/anydbm

Skip Montanaro skip at pobox.com
Sun Jun 6 12:42:43 EDT 2004


Regarding this message I'm seeing:

    *** malloc[24360]: error for object 0x680b408: Pointer being reallocated was not allocated

a breakpoint in malloc_printf (handy that) yields this stack trace info near
the call:

    Starting program: /Users/skip/tmp/python/dist/src/python.exe Lib/test/regrtest.py -f ~/tmp/tests
    test_sundry
    test_tcl
    test_tempfile
    
    Breakpoint 1, 0x90070ddc in malloc_printf ()
    (gdb) bt 10
    #0  0x90070ddc in malloc_printf ()
    #1  0x9000de5c in szone_realloc ()
    #2  0x9000dd70 in malloc_zone_realloc ()
    #3  0x9000dce8 in realloc ()
    #4  0x90010c24 in setenv ()
    #5  0x90010a74 in putenv ()
    #6  0x0012d280 in posix_putenv (self=0x0, args=0x130e038) at Modules/posixmodule.c:5685
    #7  0x000d9b84 in PyCFunction_Call (func=0x41c878, arg=0x130e038, kw=0x0) at Objects/methodobject.c:73
    #8  0x000ccc1c in call_function (pp_stack=0xbfff9480, oparg=2) at Python/ceval.c:3377
    #9  0x000c6dec in eval_frame (f=0xb41738) at Python/ceval.c:1990
    (More stack frames follow...)
    (gdb) f 6
    #6  0x0012d280 in posix_putenv (self=0x0, args=0x130e038) at Modules/posixmodule.c:5685
    (gdb) p new
    $2 = 0x1078644 "TMPDIR=/Users/skip/tmp/python/dist/src/TMPDIR"
    (gdb) pystack
    /Users/skip/tmp/python/dist/src/Lib/os.py (444): __setitem__
    /Users/skip/tmp/python/dist/src/Lib/test/test_tempfile.py (146): test_wanted_dirs
    /Users/skip/tmp/python/dist/src/Lib/unittest.py (245): run
    /Users/skip/tmp/python/dist/src/Lib/unittest.py (419): __call__
    /Users/skip/tmp/python/dist/src/Lib/unittest.py (419): __call__
    /Users/skip/tmp/python/dist/src/Lib/test/test_support.py (249): run
    /Users/skip/tmp/python/dist/src/Lib/test/test_support.py (255): run_suite
    /Users/skip/tmp/python/dist/src/Lib/test/test_support.py (278): run_unittest
    /Users/skip/tmp/python/dist/src/Lib/test/test_tempfile.py (662): test_main
    Lib/test/regrtest.py (396): runtest
    Lib/test/regrtest.py (124): main
    Lib/test/regrtest.py (77): ?

It seems that the string posix_putenv() is passing to putenv() is properly
allocated.  Setting a breakpoint in setenv() I see only three calls to it,
two from the readline initialization during test_sundry (it looks like to
set LINES and COLS - I have no source for that stuff) and one in
test_tempfile to set TMPDIR (the one causing the malloc warning).  If I
comment out the rlcompleter import in test_sundry the warning disappears and
the failing test in test_tempfile succeeds.  I'm getting libreadline
(version 4.2.0) from fink.

I'm not sure what else I can do to debug this problem.  Should I bother
(readline can be problematic)?  Any thoughts?

Skip



More information about the Python-Dev mailing list