summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2016-11-11 04:31:18 -0800
committerRaymond Hettinger <python@rcn.com>2016-11-11 04:31:18 -0800
commitcd04b2ede7e37916bf65f25d1e549e5de80dff94 (patch)
treec1c6dd005f61071d7d567df778bad9f0b0d59599 /Python
parenta7f24dfc45ddf5f45ce822de76f50cc40de1b871 (diff)
downloadcpython-cd04b2ede7e37916bf65f25d1e549e5de80dff94.tar.gz
Issue #28665: Harmonize STORE_DEREF with STORE_FAST and LOAD_DEREF giving a 40% speedup.
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index b2c90cc3b4..6bdc9983e3 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2462,8 +2462,9 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
TARGET(STORE_DEREF) {
PyObject *v = POP();
PyObject *cell = freevars[oparg];
- PyCell_Set(cell, v);
- Py_DECREF(v);
+ PyObject *oldobj = PyCell_GET(cell);
+ PyCell_SET(cell, v);
+ Py_XDECREF(oldobj);
DISPATCH();
}