mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
#17927: Keep frame from referencing cell-ified arguments.
This commit is contained in:
parent
8c01ffa6ed
commit
6832c81d5d
4 changed files with 59 additions and 5 deletions
|
@ -3519,12 +3519,20 @@ 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
|
||||
if (c == NULL)
|
||||
goto fail;
|
||||
/* Reference the cell from the argument slot, for super().
|
||||
See typeobject.c. */
|
||||
Py_INCREF(c);
|
||||
SETLOCAL(arg, c);
|
||||
}
|
||||
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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue