[Python-checkins] CVS: python/dist/src/Python compile.c,2.192,2.193

Jeremy Hylton jhylton@users.sourceforge.net
Wed, 21 Mar 2001 19:58:00 -0800


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

Modified Files:
	compile.c 
Log Message:
Set the line number correctly for a nested function with an exec or
import *.  Mark the offending stmt rather than the function def line.


Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.192
retrieving revision 2.193
diff -C2 -r2.192 -r2.193
*** compile.c	2001/03/22 03:51:05	2.192
--- compile.c	2001/03/22 03:57:58	2.193
***************
*** 4242,4246 ****
  		PyErr_SetString(PyExc_SyntaxError, buf);
  		PyErr_SyntaxLocation(c->c_symtable->st_filename,
! 				     ste->ste_lineno);
  		return -1;
  	}
--- 4242,4246 ----
  		PyErr_SetString(PyExc_SyntaxError, buf);
  		PyErr_SyntaxLocation(c->c_symtable->st_filename,
! 				     ste->ste_opt_lineno);
  		return -1;
  	}
***************
*** 4821,4826 ****
  		if (NCH(n) > 2)
  			symtable_node(st, CHILD(n, 3));
! 		else
  			st->st_cur->ste_optimized |= OPT_BARE_EXEC;
  		if (NCH(n) > 4)
  			symtable_node(st, CHILD(n, 5));
--- 4821,4828 ----
  		if (NCH(n) > 2)
  			symtable_node(st, CHILD(n, 3));
! 		else {
  			st->st_cur->ste_optimized |= OPT_BARE_EXEC;
+ 			st->st_cur->ste_opt_lineno = n->n_lineno;
+ 		}
  		if (NCH(n) > 4)
  			symtable_node(st, CHILD(n, 5));
***************
*** 5107,5110 ****
--- 5109,5113 ----
  		if (TYPE(CHILD(n, 3)) == STAR) {
  			st->st_cur->ste_optimized |= OPT_IMPORT_STAR;
+ 			st->st_cur->ste_opt_lineno = n->n_lineno;
  		} else {
  			for (i = 3; i < NCH(n); i += 2) {