[Python-checkins] python/dist/src/Python symtable.c,2.10.8.10,2.10.8.11

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
Tue, 25 Mar 2003 13:23:46 -0800


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

Modified Files:
      Tag: ast-branch
	symtable.c 
Log Message:
Don't mark var as free unless block is nested.


Index: symtable.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v
retrieving revision 2.10.8.10
retrieving revision 2.10.8.11
diff -C2 -d -r2.10.8.10 -r2.10.8.11
*** symtable.c	21 Oct 2002 21:31:11 -0000	2.10.8.10
--- symtable.c	25 Mar 2003 21:23:39 -0000	2.10.8.11
***************
*** 335,339 ****
  int 
  analyze_name(PyObject *dict, PyObject *name, int flags, PyObject *bound,
! 	     PyObject *local, PyObject *free)
  {
  	if (flags & DEF_GLOBAL) {
--- 335,339 ----
  int 
  analyze_name(PyObject *dict, PyObject *name, int flags, PyObject *bound,
! 	     PyObject *local, PyObject *free, int nested)
  {
  	if (flags & DEF_GLOBAL) {
***************
*** 349,353 ****
  		return 1;
  	}
! 	if (bound && PyDict_GetItem(bound, name)) {
  		SET_SCOPE(dict, name, FREE);
  		if (PyDict_SetItem(free, name, Py_None) < 0)
--- 349,354 ----
  		return 1;
  	}
! 	/* If the function is nested, then it can have free vars. */
! 	if (nested && bound && PyDict_GetItem(bound, name)) {
  		SET_SCOPE(dict, name, FREE);
  		if (PyDict_SetItem(free, name, Py_None) < 0)
***************
*** 444,448 ****
  	while (PyDict_Next(ste->ste_symbols, &pos, &name, &v)) {
  		flags = PyInt_AS_LONG(v);
! 		if (!analyze_name(scope, name, flags, bound, local, free))
  			goto error;
  	}
--- 445,450 ----
  	while (PyDict_Next(ste->ste_symbols, &pos, &name, &v)) {
  		flags = PyInt_AS_LONG(v);
! 		if (!analyze_name(scope, name, flags, bound, local, free,
! 				  ste->ste_nested))
  			goto error;
  	}