summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2013-05-12 23:16:06 (GMT)
committerBenjamin Peterson <benjamin@python.org>2013-05-12 23:16:06 (GMT)
commit159ae41da68ff1f1d85ed66fa6410bd9ba62ed5b (patch)
tree379d3664706b0a0dcc7d32f762d88595ae8e84bf /Python/ceval.c
parent3bfc5f5d833f081089e181cadf52d4ec50e62d13 (diff)
downloadcpython-159ae41da68ff1f1d85ed66fa6410bd9ba62ed5b.zip
cpython-159ae41da68ff1f1d85ed66fa6410bd9ba62ed5b.tar.gz
cpython-159ae41da68ff1f1d85ed66fa6410bd9ba62ed5b.tar.bz2
when an argument is a cell, set the local copy to NULL (see #17927)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index d6dba56..e211e4f 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -3521,18 +3521,14 @@ PyEval_EvalCodeEx(PyObject *_co, PyObject *globals, PyObject *locals,
if (co->co_cell2arg != NULL &&
(arg = co->co_cell2arg[i]) != CO_CELL_NOT_AN_ARG) {
c = PyCell_New(GETLOCAL(arg));
- if (c == NULL)
- goto fail;
- /* Reference the cell from the argument slot, for super().
- See typeobject.c. */
- Py_INCREF(c);
- SETLOCAL(arg, c);
+ /* Clear the local copy. */
+ SETLOCAL(arg, NULL);
}
else {
c = PyCell_New(NULL);
- if (c == NULL)
- goto fail;
}
+ if (c == NULL)
+ goto fail;
SETLOCAL(co->co_nlocals + i, c);
}
for (i = 0; i < PyTuple_GET_SIZE(co->co_freevars); ++i) {