bz2module.c breaks regression tests
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
Gustavo, I submitted the bug report via sourceforge, which is what I should have done in the first place. I also wanted to mention, since this is your first checkin, that you shouldn't feel too bad :-). Everyone is going to make some mistakes while they're learning the ropes. Jeremy
I submitted the bug report via sourceforge, which is what I should have done in the first place.
I'm not sure about what is going on there, since it's working just fine here. That makes it a little bit harder to find out what's going wrong. :-( Can you please provide me with the compilation steps you've used?
I also wanted to mention, since this is your first checkin, that you shouldn't feel too bad :-). Everyone is going to make some mistakes while they're learning the ropes.
Thank you! :-) -- Gustavo Niemeyer [ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ]
On Tue, Nov 05, 2002 at 01:11:14PM -0500, Jeremy Hylton wrote:
Gustavo,
I submitted the bug report via sourceforge, which is what I should have done in the first place.
I also wanted to mention, since this is your first checkin, that you shouldn't feel too bad :-). Everyone is going to make some mistakes while they're learning the ropes.
But it's always good to run the tests before checking in. :-) I was just running the tests and ran into the same problem. Fix checked in. I still need to do a code review. Neal
But it's always good to run the tests before checking in. :-)
Of course I've tested before checking in. I wrote the tests, after all. :-) [niemeyer@ibook ..python/dist/src]% ./python Lib/test/regrtest.py test_bz2 test_grammar test_bz2 /home/niemeyer/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 All 2 tests OK. I have no idea why it is not breaking here. I should have run valdgrind over it.
I was just running the tests and ran into the same problem. Fix checked in. I still need to do a code review.
Thank you very much! -- Gustavo Niemeyer [ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ]
Did you run with a debug build of Python (configure --with-pydebug)? I find that a debug build is essential for tracking down refcount and memory problems. Jeremy
Did you run with a debug build of Python (configure --with-pydebug)? I find that a debug build is essential for tracking down refcount and memory problems.
I'm ashamed to confess that I wasn't aware about it. Sorry. :-( -- Gustavo Niemeyer [ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ]
participants (4)
-
Gustavo Niemeyer -
Jeremy Hylton -
jeremy@alum.mit.edu -
Neal Norwitz