diff options
author | Guido van Rossum <guido@python.org> | 2013-05-10 15:47:42 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2013-05-10 15:47:42 (GMT) |
commit | 6832c81d5d2d730c38bab001e0c1b4b0569dd5ef (patch) | |
tree | f4725451768bda1987adf4eca22d2e232018fd9f /Python/ceval.c | |
parent | 8c01ffa6ede5da92ab144ad2ea609a96e308b1e6 (diff) | |
download | cpython-6832c81d5d2d730c38bab001e0c1b4b0569dd5ef.zip cpython-6832c81d5d2d730c38bab001e0c1b4b0569dd5ef.tar.gz cpython-6832c81d5d2d730c38bab001e0c1b4b0569dd5ef.tar.bz2 |
#17927: Keep frame from referencing cell-ified arguments.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r-- | Python/ceval.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index d32b6fb..d6dba56 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -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) { |