Commit 21ee37c9 authored by Skip Montanaro's avatar Skip Montanaro

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.
parent f8c8cf8a
......@@ -1376,7 +1376,6 @@ com_list_for(struct compiling *c, node *n, node *e, char *t)
com_node(c, CHILD(n, 3)); /* expr */
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);
com_assign(c, CHILD(n, 1), OP_ASSIGN, NULL);
......@@ -1395,7 +1394,6 @@ com_list_if(struct compiling *c, node *n, node *e, char *t)
int anchor = 0;
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);
com_addbyte(c, POP_TOP);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment