mirror of
https://github.com/python/cpython.git
synced 2025-07-19 17:25:54 +00:00
when arguments are cells clear the locals slot (backport of #17927)
This commit is contained in:
parent
d486707d2e
commit
e1b4cbc422
5 changed files with 63 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue