diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-05-15 03:31:26 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-05-15 03:31:26 (GMT) |
commit | e1b4cbc422efc2cc6c5bbbf26645dbb5c001cb49 (patch) | |
tree | 532371b6a46fa021141c9be584dcfab109c3114f /Python/ceval.c | |
parent | d486707d2e36f3141da3a3845066e7dabfd94198 (diff) | |
download | cpython-e1b4cbc422efc2cc6c5bbbf26645dbb5c001cb49.zip cpython-e1b4cbc422efc2cc6c5bbbf26645dbb5c001cb49.tar.gz cpython-e1b4cbc422efc2cc6c5bbbf26645dbb5c001cb49.tar.bz2 |
when arguments are cells clear the locals slot (backport of #17927)
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index f427841..e59c39d 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -3403,10 +3403,14 @@ PyEval_EvalCodeEx(PyObject *_co, PyObject *globals, PyObject *locals, int arg; /* Possibly account for the cell variable being an argument. */ if (co->co_cell2arg != NULL && - (arg = co->co_cell2arg[i]) != CO_CELL_NOT_AN_ARG) + (arg = co->co_cell2arg[i]) != CO_CELL_NOT_AN_ARG) { c = PyCell_New(GETLOCAL(arg)); - else + /* Clear the local copy. */ + SETLOCAL(arg, NULL); + } + else { c = PyCell_New(NULL); + } if (c == NULL) goto fail; SETLOCAL(co->co_nlocals + i, c); |