[Python-checkins] python/dist/src/Python compile.c,2.247,2.248

montanaro@users.sourceforge.net montanaro@users.sourceforge.net
Wed, 24 Jul 2002 23:18:44 -0700


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

Modified Files:
	compile.c 
Log Message:
remove spurious SET_LINENO from com_list_for and com_list_if.  All they do
is slow things down unnecessarily and make tracing much more verbose.
Something like

    def f(n):
	return [i for i in range(n) if i%2]

should have at most two SET_LINENO instructions, not four.  When tracing,
the current line number should be printed once, not 2*n+1 times.


Index: compile.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/compile.c,v
retrieving revision 2.247
retrieving revision 2.248
diff -C2 -d -r2.247 -r2.248
*** compile.c	20 Jun 2002 22:23:14 -0000	2.247
--- compile.c	25 Jul 2002 06:18:42 -0000	2.248
***************
*** 1377,1381 ****
  	com_addbyte(c, GET_ITER);
  	c->c_begin = c->c_nexti;
- 	com_addoparg(c, SET_LINENO, n->n_lineno);
  	com_addfwref(c, FOR_ITER, &anchor);
  	com_push(c, 1);
--- 1377,1380 ----
***************
*** 1396,1400 ****
  	int a = 0;
  	/* list_iter: 'if' test [list_iter] */
- 	com_addoparg(c, SET_LINENO, n->n_lineno);
  	com_node(c, CHILD(n, 1));
  	com_addfwref(c, JUMP_IF_FALSE, &a);
--- 1395,1398 ----