summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-05-30 21:10:46 (GMT)
committerGitHub <noreply@github.com>2023-05-30 21:10:46 (GMT)
commit5fff491bd5d6da579a28b521efd3ef15f3f42c01 (patch)
tree46c2f088c59144bbe9d72224f3c30de722f07d2b /Python/bytecodes.c
parent9ae49e3f3bdf585473f03522a1b7dd7c9e4baa6a (diff)
downloadcpython-5fff491bd5d6da579a28b521efd3ef15f3f42c01.zip
cpython-5fff491bd5d6da579a28b521efd3ef15f3f42c01.tar.gz
cpython-5fff491bd5d6da579a28b521efd3ef15f3f42c01.tar.bz2
[3.12] gh-105035: fix super() calls on unusual types (e.g. meta-types) (GH-105094) (#105117)
gh-105035: fix super() calls on unusual types (e.g. meta-types) (GH-105094) (cherry picked from commit 68c75c31536e8c87901934f2d6da81f54f4334f9) Co-authored-by: Carl Meyer <carl@oddbird.net>
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 f71a62e..0baf245 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) {