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

Peter Schneider-Kamp peter@schneider-kamp.de
Sun, 09 Jul 2000 02:28:33 +0000


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

Guido van Rossum wrote:
> 
> I get a compile error: nameval undeclared.  Which version are you
> working off?  Please use the SourceForge CVS tree!

Oops. I forget one chunk of the patch which is related to the bugfix.
By the way, I am using the CVS tree.

It's just a 'PyObject *nameval;' declaration. I have attached a
more complete patch. I still can't figure where the compiler segfaults.

Good night (or good morning),
Peter
--
Peter Schneider-Kamp          ++47-7388-7331
Herman Krags veg 51-11        mailto:peter@schneider-kamp.de
N-7050 Trondheim              http://schneider-kamp.de
--------------3FB582E288E4A74F8F945396
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;

--------------3FB582E288E4A74F8F945396--