[Python-checkins] python/dist/src/Objects frameobject.c,2.49.2.1,2.49.2.2

jhylton@sourceforge.net jhylton@sourceforge.net
Sat, 20 Apr 2002 11:21:18 -0700


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

Modified Files:
      Tag: release21-maint
	frameobject.c 
Log Message:
Backport fixes for two nested scopes bugs.

frameobject.c: make sure free and cell vars make it into locals, which
    makes eval work.

bltinmodule.c & ceval.c: make sure a code object with free variables
    that is passed to exec or eval raises an exception.

Also duplicate the current trunk test suite in the 2.1 branch, except
for certain necessary changes: different warnings raised by 2.1, need
for __future__.



Index: frameobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/frameobject.c,v
retrieving revision 2.49.2.1
retrieving revision 2.49.2.2
diff -C2 -d -r2.49.2.1 -r2.49.2.2
*** frameobject.c	23 May 2001 13:26:29 -0000	2.49.2.1
--- frameobject.c	20 Apr 2002 18:21:16 -0000	2.49.2.2
***************
*** 313,318 ****
  		}
  	}
- 	if (f->f_nlocals == 0)
- 		return;
  	map = f->f_code->co_varnames;
  	if (!PyDict_Check(locals) || !PyTuple_Check(map))
--- 313,316 ----
***************
*** 323,327 ****
  	if (j > f->f_nlocals)
  		j = f->f_nlocals;
! 	map_to_dict(map, j, locals, fast, 0);
  	if (f->f_ncells || f->f_nfreevars) {
  		if (!(PyTuple_Check(f->f_code->co_cellvars)
--- 321,326 ----
  	if (j > f->f_nlocals)
  		j = f->f_nlocals;
! 	if (f->f_nlocals)
! 	    map_to_dict(map, j, locals, fast, 0);
  	if (f->f_ncells || f->f_nfreevars) {
  		if (!(PyTuple_Check(f->f_code->co_cellvars)
***************
*** 352,356 ****
  	locals = f->f_locals;
  	map = f->f_code->co_varnames;
! 	if (locals == NULL || f->f_code->co_nlocals == 0)
  		return;
  	if (!PyDict_Check(locals) || !PyTuple_Check(map))
--- 351,355 ----
  	locals = f->f_locals;
  	map = f->f_code->co_varnames;
! 	if (locals == NULL)
  		return;
  	if (!PyDict_Check(locals) || !PyTuple_Check(map))
***************
*** 361,365 ****
  	if (j > f->f_nlocals)
  		j = f->f_nlocals;
! 	dict_to_map(f->f_code->co_varnames, j, locals, fast, 0, clear);
  	if (f->f_ncells || f->f_nfreevars) {
  		if (!(PyTuple_Check(f->f_code->co_cellvars)
--- 360,365 ----
  	if (j > f->f_nlocals)
  		j = f->f_nlocals;
! 	if (f->f_nlocals)
! 	    dict_to_map(f->f_code->co_varnames, j, locals, fast, 0, clear);
  	if (f->f_ncells || f->f_nfreevars) {
  		if (!(PyTuple_Check(f->f_code->co_cellvars)