Skip to content
Prev Previous commit
Next Next commit
Check only the free vars in super_init_without_args().
  • Loading branch information
ericsnowcurrently committed Jun 15, 2021
commit 4b086e9e57f317abc18943b4a647dcf9f5b0a3d5
7 changes: 3 additions & 4 deletions Objects/typeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -8899,10 +8899,9 @@ super_init_without_args(PyFrameObject *f, PyCodeObject *co,

// Look for __class__ in the free vars.
PyTypeObject *type = NULL;
for (int i = co->co_nlocals; i < co->co_nlocalsplus; i++) {
if ((co->co_localspluskinds[i] & CO_FAST_FREE) == 0) {
continue;
}
int i = co->co_nlocals + co->co_nplaincellvars;
for (; i < co->co_nlocalsplus; i++) {
assert((co->co_localspluskinds[i] & CO_FAST_FREE) != 0);
PyObject *name = PyTuple_GET_ITEM(co->co_localsplusnames, i);
assert(PyUnicode_Check(name));
if (_PyUnicode_EqualToASCIIId(name, &PyId___class__)) {
Expand Down