aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorCarl Meyer <carl@oddbird.net>2023-05-30 14:36:24 -0600
committerGitHub <noreply@github.com>2023-05-30 14:36:24 -0600
commit68c75c31536e8c87901934f2d6da81f54f4334f9 (patch)
treed4aa9e555bc31a642ad38ae61b3b7c57095d5f74 /Python/bytecodes.c
parent49f90ba1eae56708b1894441418c13ad8e8ea9a8 (diff)
downloadcpython-68c75c31536e8c87901934f2d6da81f54f4334f9.tar.gz
cpython-68c75c31536e8c87901934f2d6da81f54f4334f9.zip
gh-105035: fix super() calls on unusual types (e.g. meta-types) (#105094)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index f71a62e051a..0baf2451ee4 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -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) {