gh-105035: fix super() calls on unusual types (e.g. meta-types) (#105094)

This commit is contained in:
Carl Meyer 2023-05-30 14:36:24 -06:00 committed by GitHub
parent 49f90ba1ea
commit 68c75c3153
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 240 additions and 222 deletions

View file

@ -1660,8 +1660,10 @@ dummy_func(
DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR);
STAT_INC(LOAD_SUPER_ATTR, hit);
PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2);
PyTypeObject *cls = (PyTypeObject *)class;
int method_found = 0;
res2 = _PySuper_Lookup((PyTypeObject *)class, self, name, &method_found);
res2 = _PySuper_Lookup(cls, self, name,
cls->tp_getattro == PyObject_GenericGetAttr ? &method_found : NULL);
Py_DECREF(global_super);
Py_DECREF(class);
if (res2 == NULL) {

File diff suppressed because it is too large Load diff