summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c12
-rw-r--r--Python/compile.c6
-rw-r--r--Python/import.c4
3 files changed, 17 insertions, 5 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index d74d017..1af998d 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2002,6 +2002,18 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
if (x != NULL) continue;
break;
+ case STORE_MAP:
+ w = TOP(); /* key */
+ u = SECOND(); /* value */
+ v = THIRD(); /* dict */
+ STACKADJ(-2);
+ assert (PyDict_CheckExact(v));
+ err = PyDict_SetItem(v, w, u); /* v[w] = u */
+ Py_DECREF(u);
+ Py_DECREF(w);
+ if (err == 0) continue;
+ break;
+
case LOAD_ATTR:
w = GETITEM(names, oparg);
v = TOP();
diff --git a/Python/compile.c b/Python/compile.c
index 193d520..3b0c53f 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -729,6 +729,8 @@ opcode_stack_effect(int opcode, int oparg)
return -1;
case STORE_SUBSCR:
return -3;
+ case STORE_MAP:
+ return -2;
case DELETE_SUBSCR:
return -2;
@@ -2926,13 +2928,11 @@ compiler_visit_expr(struct compiler *c, expr_ty e)
/* We must arrange things just right for STORE_SUBSCR.
It wants the stack to look like (value) (dict) (key) */
for (i = 0; i < n; i++) {
- ADDOP(c, DUP_TOP);
VISIT(c, expr,
(expr_ty)asdl_seq_GET(e->v.Dict.values, i));
- ADDOP(c, ROT_TWO);
VISIT(c, expr,
(expr_ty)asdl_seq_GET(e->v.Dict.keys, i));
- ADDOP(c, STORE_SUBSCR);
+ ADDOP(c, STORE_MAP);
}
break;
case ListComp_kind:
diff --git a/Python/import.c b/Python/import.c
index bf2799d..bcae9b2 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -66,10 +66,10 @@ extern time_t PyOS_GetLastModificationTime(char *, FILE *);
Python 2.5c1: 62121 (fix wrong lnotab with for loops and
storing constants that should have been removed)
Python 2.5c2: 62131 (fix wrong code: for x, in ... in listcomp/genexp)
- Python 2.6a0: 62141 (peephole optimizations)
+ Python 2.6a0: 62151 (peephole optimizations and STORE_MAP opcode)
.
*/
-#define MAGIC (62141 | ((long)'\r'<<16) | ((long)'\n'<<24))
+#define MAGIC (62151 | ((long)'\r'<<16) | ((long)'\n'<<24))
/* Magic word as global; note that _PyImport_Init() can change the
value of this global to accommodate for alterations of how the