[Python-checkins] CVS: python/dist/src/Python compile.c,2.161,2.162

Jeremy Hylton jhylton@users.sourceforge.net
Fri, 09 Feb 2001 14:55:28 -0800


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv16822/Python

Modified Files:
	compile.c 
Log Message:
SF patch 103589: Fix handling of cell vars that are either * or ** parameters.
(Nick Mathewson)

Remove to XXX comments



Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.161
retrieving revision 2.162
diff -C2 -r2.161 -r2.162
*** compile.c	2001/02/09 22:22:18	2.161
--- compile.c	2001/02/09 22:55:26	2.162
***************
*** 2487,2494 ****
  	*/
  
- 	/* XXX should __debug__ and AssertionError get inserted into
- 	   the symbol table?  they don't follow the normal rules
- 	   because they are always loaded as globals */
- 
  	if (Py_OptimizeFlag)
  		return;
--- 2487,2490 ----
***************
*** 3525,3532 ****
  }
  
- /* XXX This function could probably be made simpler, because it
-    doesn't do anything except generate code for complex arguments. 
- */
- 
  static void
  com_arglist(struct compiling *c, node *n)
--- 3521,3524 ----
***************
*** 3580,3589 ****
--- 3572,3591 ----
  			ch = CHILD(n, i+1);
  			if (TYPE(ch) == NAME) {
+ 				PyObject *v;
  				i += 3;
+ 				v = PyDict_GetItemString(c->c_cellvars,
+ 							 STR(ch));
+ 				if (v) {
+ 					com_addoparg(c, LOAD_FAST, narg);
+ 					com_addoparg(c, STORE_DEREF, 
+ 						     PyInt_AS_LONG(v));
  			}
+ 				narg++;
  		}
  	}
+ 	}
  	/* Handle **keywords */
  	if (i < nch) {
+ 		PyObject *v;
  		node *ch;
  		ch = CHILD(n, i);
***************
*** 3597,3600 ****
--- 3599,3607 ----
  			ch = CHILD(n, i+1);
  		REQ(ch, NAME);
+ 		v = PyDict_GetItemString(c->c_cellvars, STR(ch));
+ 		if (v) {
+ 			com_addoparg(c, LOAD_FAST, narg);
+ 			com_addoparg(c, STORE_DEREF, PyInt_AS_LONG(v));
+ 		}			
  	}
  	if (complex) {