diff Python/compile.c @ 36824:07f330ad1b47 legacy-trunk

SF bug 1442442: LIST_APPEND optimization got lost in the AST merge. Add it back.
author Neal Norwitz <nnorwitz@gmail.com>
date Fri, 03 Mar 2006 20:29:11 +0000
parents c552f2275782
children fc10ff322df1
line wrap: on
line diff
--- a/Python/compile.c	Fri Mar 03 20:21:48 2006 +0000
+++ b/Python/compile.c	Fri Mar 03 20:29:11 2006 +0000
@@ -1297,6 +1297,9 @@
 		case UNARY_INVERT:
 			return 0;
 
+		case LIST_APPEND:
+			return -2;
+
 		case BINARY_POWER:
 		case BINARY_MULTIPLY:
 		case BINARY_DIVIDE:
@@ -3149,8 +3152,7 @@
 	    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 @@
 		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);