Fix for default args causes an unrelated segfault
"logistix" <[email protected]> Sun, 25 May 2003 18:59:49 -0400
| Newsgroups | gmane.comp.python.compiler |
|---|---|
| Message-ID | <000001c32311$587bcb30$20bba8c0@XP> |
One of the big problems preventing successful compilation of site.py was improper handing of keyword arguments: >>> def foo(a,b=1):print a,b >>> foo(1) This also prevented me from being able to import dis to look at function objects. I tracked down the problem. MAKE_FUNCTION was getting sent the wrong parameter. However, the fix causes an unrelated segfault. I tracked the segfault down to the sre package. This gets imported via the warnings module, which in turn gets imported whether or not you use the "-S" flag when running python. Simply renaming "re.py" to "_re.py" and killing the existing .pyc file eliminates the segfault. Previously, "site.py" failed before it got the opportunity to import re, preventing the error from being raised. Since that's all it takes to eliminate the segfault, I feel confortable in my patch. But I also didn't want to shoot a patch to SourceForge that breaks a working build. So, here you go, -Grant P.S. Is there any way to temporarily shut off the compile trace at the interactive prompt?
newcompile.diff
(application/octet-stream, 336 B)
Index: newcompile.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Python/Attic/newcompile.c,v retrieving revision 1.1.2.53 diff -r1.1.2.53 newcompile.c 717c717 < ADDOP_I(c, MAKE_FUNCTION, c->u->u_argcount); --- > ADDOP_I(c, MAKE_FUNCTION, asdl_seq_LEN(args->defaults));