[Python-Dev] compile.c: problem with duplicate argument bugfix

Peter Schneider-Kamp peter@schneider-kamp.de
Sun, 09 Jul 2000 23:17:44 +0000


This is a multi-part message in MIME format.
--------------EDF4EC1E815749A45E1B5A7C
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

While "slaving away" on the Modules/ directory (thanks for
the term - it made my day <wink>), I still haven't got a
clue why Python crashes on me when I throw an error on
duplicate arguments like in:

[example]

>>> def f(a, a): print a
segfault

[/example]

Any help is again appreciated. Or should I just load up that
mini patch to SF and wait for some unlucky guy that assigns
it on himself <0.5 wink>?

okay, back to Modules/r* - z*
Peter
--
Peter Schneider-Kamp          ++47-7388-7331
Herman Krags veg 51-11        mailto:peter@schneider-kamp.de
N-7050 Trondheim              http://schneider-kamp.de
--------------EDF4EC1E815749A45E1B5A7C
Content-Type: text/plain; charset=us-ascii;
 name="compile_funcdef.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="compile_funcdef.patch"

diff -c -d -T --recursive python/dist/src/Python/compile.c python-mod/dist/src/Python/compile.c
*** python/dist/src/Python/compile.c	Mon Jul  3 21:39:47 2000
--- python-mod/dist/src/Python/compile.c	Sun Jul  9 02:04:26 2000
***************
*** 3092,3097 ****
--- 3092,3098 ----
 			node *ch = CHILD(n, i);
 			node *fp;
 			char *name;
+			PyObject *nameval;
 			if (TYPE(ch) == STAR || TYPE(ch) == DOUBLESTAR)
 				break;
 			REQ(ch, fpdef); /* fpdef: NAME | '(' fplist ')' */
***************
*** 3103,3109 ****
 				sprintf(nbuf, ".%d", i);
 				complex = 1;
 			}
!			com_newlocal(c, name);
 			c->c_argcount++;
 			if (++i >= nch)
 				break;
--- 3104,3118 ----
 				sprintf(nbuf, ".%d", i);
 				complex = 1;
 			}
!			nameval = PyString_InternFromString(name);
!			if (nameval == NULL) {
!				c->c_errors++;
!			}
!			if (PyDict_GetItem(c->c_locals, nameval)) {
!				com_error(c, PyExc_SyntaxError,"double identifier in function definition");
!			}
!			com_newlocal_o(c, nameval);
!			Py_DECREF(nameval);
 			c->c_argcount++;
 			if (++i >= nch)
 				break;


--------------EDF4EC1E815749A45E1B5A7C--