[Python-checkins] python/dist/src/Python symtable.c, 2.10.8.20, 2.10.8.21

jhylton at users.sourceforge.net jhylton at users.sourceforge.net
Sat Feb 14 23:17:23 EST 2004


Update of /cvsroot/python/python/dist/src/Python
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6408

Modified Files:
      Tag: ast-branch
	symtable.c 
Log Message:
Set ste_optimized correctly.

The rule is that a FunctionBlock is "optimized" unless it has an
import * or an exec.


Index: symtable.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v
retrieving revision 2.10.8.20
retrieving revision 2.10.8.21
diff -C2 -d -r2.10.8.20 -r2.10.8.21
*** symtable.c	27 Jan 2004 16:36:30 -0000	2.10.8.20
--- symtable.c	15 Feb 2004 04:17:21 -0000	2.10.8.21
***************
*** 41,45 ****
  
  	ste->ste_type = block;
! 	ste->ste_optimized = 0;
  	ste->ste_varargs = 0;
  	ste->ste_varkeywords = 0;
--- 41,45 ----
  
  	ste->ste_type = block;
! 	ste->ste_optimized = block == FunctionBlock;
  	ste->ste_varargs = 0;
  	ste->ste_varkeywords = 0;
***************
*** 519,524 ****
  	PySTEntryObject *prev = NULL;
  
- 	// fprintf(stderr, "enter block %s %d\n", PyString_AS_STRING(name), lineno);
- 
  	if (st->st_cur) {
  		prev = st->st_cur;
--- 519,522 ----
***************
*** 714,717 ****
--- 712,716 ----
          case Exec_kind:
  		VISIT(st, expr, s->v.Exec.body);
+ 		st->st_cur->ste_optimized = 0;
  		if (s->v.Exec.globals) {
  			VISIT(st, expr, s->v.Exec.globals);
***************
*** 923,927 ****
  {
  	PyObject *name = (a->asname == NULL) ? a->name : a->asname;
! 	return symtable_add_def(st, name, DEF_IMPORT);
  }
  
--- 922,931 ----
  {
  	PyObject *name = (a->asname == NULL) ? a->name : a->asname;
! 	if (strcmp(PyString_AS_STRING(name), "*"))
! 	    return symtable_add_def(st, name, DEF_IMPORT);
! 	else {
! 	    st->st_cur->ste_optimized = 0;
! 	    return 1;
! 	}
  }
  




More information about the Python-checkins mailing list