Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 24373:f79c7aae6620 legacy-trunk
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.
| author | Skip Montanaro <skip@pobox.com> |
|---|---|
| date | Thu, 25 Jul 2002 06:18:42 +0000 |
| parents | f7ce696979e1 |
| children | 3444005b6527 |
line wrap: on
line diff
--- a/Python/compile.c Wed Jul 24 19:13:08 2002 +0000 +++ b/Python/compile.c Thu Jul 25 06:18:42 2002 +0000 @@ -1376,7 +1376,6 @@ 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 @@ 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);
