8000 gh-123465: Allow Py_RELATIVE_OFFSET for __*offset__ members by encukou · Pull Request #123474 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-123465: Allow Py_RELATIVE_OFFSET for __*offset__ members #123474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Initialize the test class properly
  • Loading branch information
encukou committed Aug 29, 2024
commit b02ae16af966cb76528f5d85557615e2f5a62738
28 changes: 23 additions & 5 deletions Modules/_testlimitedcapi/vectorcall_limited.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# define Py_LIMITED_API 0x030c0000
#endif

#include <stddef.h> // offsetof

#include "parts.h"
#include "clinic/vectorcall_limited.c.h"

Expand Down Expand Up @@ -175,18 +177,34 @@
.slots = LimitedVectorallClass_slots,
};

typedef struct {
vectorcallfunc vfunc;
} LimitedRelativeVectorCallStruct;

static PyObject *
LimitedRelativeVectorCallClass_new(PyTypeObject *tp, PyTypeObject *a, PyTypeObject *kw)
{
PyObject *self = ((allocfunc)PyType_GetSlot(tp, Py_tp_alloc))(tp, 0);
if (!self) {
return NULL;
}
LimitedRelativeVectorCallStruct *data = PyObject_GetTypeData(self, tp);
data->vfunc = LimitedVectorCallClass_vectorcall;
return self;
}


static PyType_Spec LimitedRelativeVectorCallClass_spec = {
.name = "_testlimitedcapi.LimitedRelativeVectorCallClass",
.basicsize = (int) -sizeof(vectorcallfunc),
.basicsize = (int) -sizeof(LimitedRelativeVectorCallStruct),

Check warning on line 199 in Modules/_testlimitedcapi/vectorcall_limited.c

View workflow job for this annotation

GitHub Actions / Windows / build (arm64)

unary minus operator applied to unsigned type, result still unsigned [D:\a\cpython\cpython\PCbuild\_testlimitedcapi.vcxproj]

Check warning on line 199 in Modules/_testlimitedcapi/vectorcall_limited.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build (arm64)

unary minus operator applied to unsigned type, result still unsigned [D:\a\cpython\cpython\PCbuild\_testlimitedcapi.vcxproj]

Check warning on line 199 in Modules/_testlimitedcapi/vectorcall_limited.c

View workflow job for this annotation

GitHub Actions / Windows / build and test (x64)

unary minus operator applied to unsigned type, result still unsigned [D:\a\cpython\cpython\PCbuild\_testlimitedcapi.vcxproj]

Check warning on line 199 in Modules/_testlimitedcapi/vectorcall_limited.c

View workflow job for this annotation

GitHub Actions / Windows (free-threading) / build and test (x64)

unary minus operator applied to unsigned type, result still unsigned [D:\a\cpython\cpython\PCbuild\_testlimitedcapi.vcxproj]
.flags = Py_TPFLAGS_DEFAULT
| Py_TPFLAGS_HAVE_VECTORCALL
| Py_TPFLAGS_BASETYPE,
| Py_TPFLAGS_HAVE_VECTORCALL,
.slots = (PyType_Slot[]) {
{Py_tp_new, LimitedVectorCallClass_new},
{Py_tp_new, LimitedRelativeVectorCallClass_new},
{Py_tp_call, LimitedVectorCallClass_tpcall},
{Py_tp_members, (PyMemberDef[]){
{"__vectorcalloffset__", Py_T_PYSSIZET,
0,
offsetof(LimitedRelativeVectorCallStruct, vfunc),
Py_READONLY | Py_RELATIVE_OFFSET},
{NULL}
}},
Expand Down
Loading
0