Skip to content

Commit 164f351

Browse files
DinoVfacebook-github-bot
authored andcommitted
Fix 3.12 super implementation
Summary: Fixes a couple of issues which are causing `test_super` to fail on 3.12: 1) We don't actually respect the global super object at all! We are using the exported Cinder function to implement this on 3.10, but just calling the equivalent of `Ci_Super_Lookup` on 3.12. Because we need to have the `global_super != &PySuper_Type` logic on 3.12 this just brings it over and stops exporting it from Cinder 3.10. 3) We get `no_args_in_super_call` backwards as oparg is effectively the number of arguments. 2) Ports the fix in python/cpython#106977 to the implementation of super in both the JIT and Cinder 3.10. Reviewed By: alexmalyshev Differential Revision: D71638145 fbshipit-source-id: 0f5a189d8cea573034e578c921925ce2988c3bb1
1 parent af34be5 commit 164f351

2 files changed

Lines changed: 1 addition & 19 deletions

File tree

Include/cinder/exports.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,6 @@ CiAPI_FUNC(PyFrameObject *)
168168
Cix_PyEval_MakeFrameVector(PyThreadState *tstate, PyFrameConstructor *con,
169169
PyObject *locals, PyObject *const *args,
170170
Py_ssize_t argcount, PyObject *kwnames);
171-
CiAPI_FUNC(PyObject *)
172-
Cix_SuperLookupMethodOrAttr(PyThreadState *tstate, PyObject *global_super,
173-
PyTypeObject *type, PyObject *self,
174-
PyObject *name, int call_no_args,
175-
int *meth_found);
176171
CiAPI_FUNC(void) Cix_format_exc_check_arg(PyThreadState *, PyObject *,
177172
const char *, PyObject *);
178173
CiAPI_FUNC(PyObject *)

Python/ceval.c

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ super_lookup_method_or_attr(PyThreadState *tstate,
16141614
}
16151615
return result;
16161616
}
1617-
if (type->tp_getattro != PyObject_GenericGetAttr) {
1617+
if (Py_TYPE(self)->tp_getattro != PyObject_GenericGetAttr) {
16181618
meth_found = NULL;
16191619
}
16201620
return Ci_Super_Lookup(type, self, name, NULL, meth_found);
@@ -6469,19 +6469,6 @@ Cix_format_exc_check_arg(PyThreadState *tstate, PyObject *exc,
64696469
format_exc_check_arg(tstate, exc, format_str, obj);
64706470
}
64716471

6472-
PyObject *
6473-
Cix_SuperLookupMethodOrAttr(PyThreadState *tstate,
6474-
PyObject *global_super,
6475-
PyTypeObject *type,
6476-
PyObject *self,
6477-
PyObject *name,
6478-
int call_no_args,
6479-
int *meth_found)
6480-
{
6481-
return super_lookup_method_or_attr(
6482-
tstate, global_super, type, self, name, call_no_args, meth_found);
6483-
}
6484-
64856472
int
64866473
Cix_eval_frame_handle_pending(PyThreadState *tstate) {
64876474
return eval_frame_handle_pending(tstate);

0 commit comments

Comments
 (0)