diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2008-12-18 11:06:25 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2008-12-18 11:06:25 (GMT) |
commit | f289ae6f01683689dfd07785c9617175b40aea91 (patch) | |
tree | dd9a6f78817fcedbd95db286188507cf21a52bc0 /Python/ceval.c | |
parent | 621601a698a285a45231a6fd223db33566dcb842 (diff) | |
download | cpython-f289ae6f01683689dfd07785c9617175b40aea91.zip cpython-f289ae6f01683689dfd07785c9617175b40aea91.tar.gz cpython-f289ae6f01683689dfd07785c9617175b40aea91.tar.bz2 |
Merged revisions 67818 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r67818 | antoine.pitrou | 2008-12-17 01:38:28 +0100 (mer., 17 déc. 2008) | 3 lines
Issue #2183: Simplify and optimize bytecode for list comprehensions.
........
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index b17d3db..2ce3ec9 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -1306,9 +1306,8 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) case LIST_APPEND: w = POP(); - v = POP(); + v = stack_pointer[-oparg]; err = PyList_Append(v, w); - Py_DECREF(v); Py_DECREF(w); if (err == 0) { PREDICT(JUMP_ABSOLUTE); @@ -1318,9 +1317,8 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) case SET_ADD: w = POP(); - v = POP(); + v = stack_pointer[-oparg]; err = PySet_Add(v, w); - Py_DECREF(v); Py_DECREF(w); if (err == 0) { PREDICT(JUMP_ABSOLUTE); @@ -1935,6 +1933,21 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) if (err == 0) continue; break; + case MAP_ADD: + w = TOP(); /* key */ + u = SECOND(); /* value */ + STACKADJ(-2); + v = stack_pointer[-oparg]; /* dict */ + assert (PyDict_CheckExact(v)); + err = PyDict_SetItem(v, w, u); /* v[w] = u */ + Py_DECREF(u); + Py_DECREF(w); + if (err == 0) { + PREDICT(JUMP_ABSOLUTE); + continue; + } + break; + case LOAD_ATTR: w = GETITEM(names, oparg); v = TOP(); |