[Python-checkins] CVS: python/dist/src/Python ceval.c,2.227,2.228

Jeremy Hylton jhylton@users.sourceforge.net
Mon, 05 Feb 2001 09:23:19 -0800


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

Modified Files:
	ceval.c 
Log Message:
SF patch 103596 by Nick Mathewson: rause UnboundLocalError for
uninitialized free variables


Index: ceval.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/ceval.c,v
retrieving revision 2.227
retrieving revision 2.228
diff -C2 -r2.227 -r2.228
*** ceval.c	2001/02/01 22:48:12	2.227
--- ceval.c	2001/02/05 17:23:16	2.228
***************
*** 1647,1650 ****
--- 1647,1666 ----
  			x = freevars[oparg];
  			w = PyCell_Get(x);
+ 			if (w == NULL) {
+ 				if (oparg < f->f_ncells)
+ 					v = PyTuple_GetItem(co->co_cellvars,
+ 							       oparg);
+ 				else
+ 				       v = PyTuple_GetItem(
+ 						      co->co_freevars,
+ 						      oparg - f->f_ncells);
+ 
+ 				format_exc_check_arg(
+ 					PyExc_UnboundLocalError,
+ 					UNBOUNDLOCAL_ERROR_MSG,
+ 					v);
+ 				err = -1;
+ 				break;
+ 			}
  			Py_INCREF(w);
  			PUSH(w);