diff options
author | Raymond Hettinger <python@rcn.com> | 2016-11-12 09:10:35 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2016-11-12 09:10:35 (GMT) |
commit | c32f9db846ca6f66fa541aee73069d9324b863b7 (patch) | |
tree | f2e60f3f09fa3f48273749b036b081ea7bcda532 /Python | |
parent | e42df24d72cf0dc419b52b86d6466cb9fd7e36ec (diff) | |
download | cpython-c32f9db846ca6f66fa541aee73069d9324b863b7.zip cpython-c32f9db846ca6f66fa541aee73069d9324b863b7.tar.gz cpython-c32f9db846ca6f66fa541aee73069d9324b863b7.tar.bz2 |
Issue #28665: Use macro form of PyCell_GET/SET
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index fe562a8..eefe66f 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2405,8 +2405,10 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag) TARGET(DELETE_DEREF) { PyObject *cell = freevars[oparg]; - if (PyCell_GET(cell) != NULL) { - PyCell_Set(cell, NULL); + PyObject *oldobj = PyCell_GET(cell); + if (oldobj != NULL) { + PyCell_SET(cell, NULL); + Py_DECREF(oldobj); DISPATCH(); } format_exc_unbound(co, oparg); @@ -5351,8 +5353,10 @@ unicode_concatenate(PyObject *v, PyObject *w, PyObject **freevars = (f->f_localsplus + f->f_code->co_nlocals); PyObject *c = freevars[oparg]; - if (PyCell_GET(c) == v) - PyCell_Set(c, NULL); + if (PyCell_GET(c) == v) { + PyCell_SET(c, NULL); + Py_DECREF(v); + } break; } case STORE_NAME: |