]> granicus.if.org Git - python/commitdiff
remove spurious SET_LINENO from com_list_for and com_list_if. All they do
authorSkip Montanaro <skip@pobox.com>
Thu, 25 Jul 2002 06:18:42 +0000 (06:18 +0000)
committerSkip Montanaro <skip@pobox.com>
Thu, 25 Jul 2002 06:18:42 +0000 (06:18 +0000)
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.

Python/compile.c

index fa53b1ea85a326649c0d8b099a2fe0eae7b2d5b5..296653210a77bbd1cbeba2409cab6ba4520ae57e 100644 (file)
@@ -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);