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.
This commit is contained in:
parent
f8c8cf8a9d
commit
21ee37c94e
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue