summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-03-03 20:29:11 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-03-03 20:29:11 (GMT)
commit10be2ea85d081bc5b2b0529b76d104d749707394 (patch)
tree604dc31140bcabb8edafef4e3f3218797eed0c9e /Python
parentd4e30357016f0b2e2a5093d810b7edea33501cd3 (diff)
downloadcpython-10be2ea85d081bc5b2b0529b76d104d749707394.zip
cpython-10be2ea85d081bc5b2b0529b76d104d749707394.tar.gz
cpython-10be2ea85d081bc5b2b0529b76d104d749707394.tar.bz2
SF bug 1442442: LIST_APPEND optimization got lost in the AST merge.
Add it back.
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 7abc117..c07b6d3 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1297,6 +1297,9 @@ opcode_stack_effect(int opcode, int oparg)
case UNARY_INVERT:
return 0;
+ case LIST_APPEND:
+ return -2;
+
case BINARY_POWER:
case BINARY_MULTIPLY:
case BINARY_DIVIDE:
@@ -3149,8 +3152,7 @@ compiler_listcomp_generator(struct compiler *c, PyObject *tmpname,
if (!compiler_nameop(c, tmpname, Load))
return 0;
VISIT(c, expr, elt);
- ADDOP_I(c, CALL_FUNCTION, 1);
- ADDOP(c, POP_TOP);
+ ADDOP(c, LIST_APPEND);
compiler_use_next_block(c, skip);
}
@@ -3189,7 +3191,6 @@ compiler_listcomp(struct compiler *c, expr_ty e)
return 0;
ADDOP_I(c, BUILD_LIST, 0);
ADDOP(c, DUP_TOP);
- ADDOP_O(c, LOAD_ATTR, append, names);
if (compiler_nameop(c, tmp, Store))
rc = compiler_listcomp_generator(c, tmp, generators, 0,
e->v.ListComp.elt);