[Python-Dev] bz2module.c breaks regression tests

Jeremy Hylton jeremy@alum.mit.edu
Tue, 5 Nov 2002 12:57:32 -0500


I just did a cvs update and a fresh build of Python dies with a
segfault immediately after running test_bz2.

build-pydebug> ./python ../Lib/test/regrtest.py test_bz2 test_grammar
test_bz2
/usr/home/jeremy/src/python/dist/src/Lib/test/test_bz2.py:30: RuntimeWarning: mktemp is a potential security risk to your program
  self.filename = tempfile.mktemp("bz2")
test_grammar
Segmentation fault (core dumped)

A partial gdb stack trace shows that it's dying in PyObject_Malloc().
I'm running with a debug build of Python.  Not sure what, if anything,
it would do with a release build.

#0  0x080828b7 in PyObject_Malloc (nbytes=17) at ../Objects/obmalloc.c:581
#1  0x08082f5c in _PyObject_DebugMalloc (nbytes=1) at ../Objects/obmalloc.c:992
#2  0x080553e5 in parsetok (tok=0x81b2fc0, g=0x81466a8, start=257, 
    err_ret=0xbfffdfe0, flags=0) at ../Parser/parsetok.c:137
#3  0x08055218 in PyParser_ParseStringFlagsFilename (
    s=0x401fcd44 "if 1:\n    exec u'z=1+1\\n'\n    if z != 2: raise TestFailed, 'exec u\\'z=1+1\\'\\\\n'\n    del z\n    exec u'z=1+1'\n    if z != 2: raise TestFailed, 'exec u\\'z=1+1\\''\n", filename=0x0, g=0x81466a8, start=257, 
    err_ret=0xbfffdfe0, flags=0) at ../Parser/parsetok.c:56
#4  0x08055156 in PyParser_ParseStringFlags (
    s=0x401fcd44 "if 1:\n    exec u'z=1+1\\n'\n    if z != 2: raise TestFailed, 'exec u\\'z=1+1\\'\\\\n'\n    del z\n    exec u'z=1+1'\n    if z != 2: raise TestFailed, 'exec u\\'z=1+1\\''\n", g=0x81466a8, start=257, err_ret=0xbfffdfe0, 
    flags=0) at ../Parser/parsetok.c:31
#5  0x080e653f in PyParser_SimpleParseStringFlags (
    str=0x401fcd44 "if 1:\n    exec u'z=1+1\\n'\n    if z != 2: raise TestFailed, 'exec u\\'z=1+1\\'\\\\n'\n    del z\n    exec u'z=1+1'\n    if z != 2: raise TestFailed, 'exec u\\'z=1+1\\''\n", start=257, flags=0)
    at ../Python/pythonrun.c:1193
#6  0x080e6580 in PyParser_SimpleParseString (
    str=0x401fcd44 "if 1:\n    exec u'z=1+1\\n'\n    if z != 2: raise TestFailed, 'exec u\\'z=1+1\\'\\\\n'\n    del z\n    exec u'z=1+1'\n    if z != 2: raise TestFailed, 'exec u\\'z=1+1\\''\n", start=257) at ../Python/pythonrun.c:1203
#7  0x080e5fbc in PyRun_String (
    str=0x401fcd44 "if 1:\n    exec u'z=1+1\\n'\n    if z != 2: raise TestFailed, 'exec u\\'z=1+1\\'\\\\n'\n    del z\n    exec u'z=1+1'\n    if z != 2: raise TestFailed, 'exec u\\'z=1+1\\''\n", start=257, globals=0x4020c994, 
    locals=0x4020c3f4) at ../Python/pythonrun.c:1025
#8  0x080c431e in exec_statement (f=0x818410c, prog=0x401fcd28, 
    globals=0x4020c994, locals=0x4020c3f4) at ../Python/ceval.c:3786
#9  0x080bca30 in eval_frame (f=0x818410c) at ../Python/ceval.c:1539
#10 0x080c0b69 in PyEval_EvalCodeEx (co=0x40263b28, globals=0x4020c994, 
    locals=0x0, args=0x815907c, argcount=0, kws=0x815907c, kwcount=0, 
    defs=0x0, defcount=0, closure=0x0) at ../Python/ceval.c:2542
#11 0x080c2996 in fast_function (func=0x402222b4, pp_stack=0xbfffe328, n=0, 
    na=0, nk=0) at ../Python/ceval.c:3282
#12 0x080c2818 in call_function (pp_stack=0xbfffe328, oparg=0)
    at ../Python/ceval.c:3251
#13 0x080beb80 in eval_frame (f=0x8158f24) at ../Python/ceval.c:1997
#14 0x080c0b69 in PyEval_EvalCodeEx (co=0x4021e238, globals=0x4020c994, 
    locals=0x4020c994, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, 
    defcount=0, closure=0x0) at ../Python/ceval.c:2542
#15 0x080b6abc in PyEval_EvalCode (co=0x4021e238, globals=0x4020c994, 
    locals=0x4020c994) at ../Python/ceval.c:478
#16 0x080dadc3 in PyImport_ExecCodeModuleEx (
    name=0xbfffed48 "test.test_grammar", co=0x4021e238, 
    pathname=0xbfffe440 "/usr/home/jeremy/src/python/dist/src/Lib/test/test_grammar.pyc") at ../Python/import.c:530

Jeremy