[Python-checkins] python/dist/src/Python symtable.c,2.10.8.4,2.10.8.5

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
2002年8月23日 15:51:53 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv11495/Python
Modified Files:
 Tag: ast-branch
	symtable.c 
Log Message:
Remove use of old members.
Don't restore st_cur on exit from the top-level scope.
Index: symtable.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/symtable.c,v
retrieving revision 2.10.8.4
retrieving revision 2.10.8.5
diff -C2 -d -r2.10.8.4 -r2.10.8.5
*** symtable.c	4 Aug 2002 21:12:15 -0000	2.10.8.4
--- symtable.c	23 Aug 2002 22:51:51 -0000	2.10.8.5
***************
*** 188,192 ****
 		goto fail; 
 	st->st_cur = NULL;
- 	st->st_errors = 0;
 	st->st_tmpname = 0;
 	st->st_private = NULL;
--- 188,191 ----
***************
*** 218,222 ****
 			 (void *)mod, 0);
 	/* Any other top-level initialization? */
! 	if (mod->kind == Module_kind) {
 		int i;
 		asdl_seq *seq = mod->v.Module.body;
--- 217,223 ----
 			 (void *)mod, 0);
 	/* Any other top-level initialization? */
! 	switch (mod->kind) {
! 	case Module_kind: 
! 	{
 		int i;
 		asdl_seq *seq = mod->v.Module.body;
***************
*** 227,230 ****
--- 228,238 ----
 			}
 	}
+ 	break;
+ 	case Expression_kind:
+ 		symtable_visit_expr(st, mod->v.Expression.body);
+ 		break;
+ 	default:
+ 		return NULL;
+ 	}
 	symtable_exit_block(st, (void *)mod);
 	return st;
***************
*** 232,236 ****
 
 int 
! PySTEntry_GetScope(PySTEntryObject *ste, PyObject *name)
 {
 	PyObject *v;
--- 240,244 ----
 
 int 
! PyST_GetScope(PySTEntryObject *ste, PyObject *name)
 {
 	PyObject *v;
***************
*** 475,483 ****
 	Py_DECREF(st->st_cur);
 	end = PyList_GET_SIZE(st->st_stack) - 1;
! 	st->st_cur = (PySTEntryObject *)PyList_GET_ITEM(st->st_stack, 
! 							 end);
! 	if (PySequence_DelItem(st->st_stack, end) < 0)
! 		return -1;
! 	return 0;
 }
 
--- 483,493 ----
 	Py_DECREF(st->st_cur);
 	end = PyList_GET_SIZE(st->st_stack) - 1;
! 	if (end >= 0) {
! 		st->st_cur = (PySTEntryObject *)PyList_GET_ITEM(st->st_stack, 
! 								end);
! 		if (PySequence_DelItem(st->st_stack, end) < 0)
! 			return 0;
! 	}
! 	return 1;
 }
 
***************
*** 492,496 ****
 		if (PyList_Append(st->st_stack, (PyObject *)st->st_cur) < 0) {
 			Py_DECREF(st->st_cur);
- 			st->st_errors++;
 			return 0;
 		}
--- 502,505 ----
***************
*** 499,506 ****
 	if (name == GET_IDENTIFIER(top))
 		st->st_global = st->st_cur->ste_symbols;
! 	if (prev && st->st_pass == 1) {
 		if (PyList_Append(prev->ste_children, 
 				 (PyObject *)st->st_cur) < 0) {
- 			st->st_errors++;
 			return 0;
 		}
--- 508,514 ----
 	if (name == GET_IDENTIFIER(top))
 		st->st_global = st->st_cur->ste_symbols;
! 	if (prev) {
 		if (PyList_Append(prev->ste_children, 
 				 (PyObject *)st->st_cur) < 0) {
 			return 0;
 		}

AltStyle によって変換されたページ (->オリジナル) /