summaryrefslogtreecommitdiffstats
path: root/Objects/typeobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/typeobject.c')
-rw-r--r--Objects/typeobject.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index e418a3a..a351667 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -6510,9 +6510,17 @@ super_init(PyObject *self, PyObject *args, PyObject *kwds)
return -1;
}
obj = f->f_localsplus[0];
- if (obj != NULL && PyCell_Check(obj)) {
- /* It might be a cell. See cell var initialization in ceval.c. */
- obj = PyCell_GET(obj);
+ if (obj == NULL && co->co_cell2arg) {
+ /* The first argument might be a cell. */
+ n = PyTuple_GET_SIZE(co->co_cellvars);
+ for (i = 0; i < n; i++) {
+ if (co->co_cell2arg[i] == 0) {
+ PyObject *cell = f->f_localsplus[co->co_nlocals + i];
+ assert(PyCell_Check(cell));
+ obj = PyCell_GET(cell);
+ break;
+ }
+ }
}
if (obj == NULL) {
PyErr_SetString(PyExc_RuntimeError,