Skip to content

Commit c5c6295

Browse files
committed
gh-111178: Fix function signatures for test_capi
1 parent 491b814 commit c5c6295

File tree

4 files changed

+31
-20
lines changed

4 files changed

+31
-20
lines changed

Modules/_ctypes/_ctypes.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3801,8 +3801,9 @@ _validate_paramflags(ctypes_state *st, PyTypeObject *type, PyObject *paramflags)
38013801
}
38023802

38033803
static int
3804-
_get_name(PyObject *obj, const char **pname)
3804+
_get_name(PyObject *obj, void *arg)
38053805
{
3806+
const char **pname = (const char **)arg;
38063807
#ifdef MS_WIN32
38073808
if (PyLong_Check(obj)) {
38083809
/* We have to use MAKEINTRESOURCEA for Windows CE.

Modules/_testcapi/heaptype.c

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -605,15 +605,17 @@ heapctype_init(PyObject *self, PyObject *args, PyObject *kwargs)
605605
}
606606

607607
static int
608-
heapgcctype_traverse(HeapCTypeObject *self, visitproc visit, void *arg)
608+
heapgcctype_traverse(PyObject *op, visitproc visit, void *arg)
609609
{
610+
HeapCTypeObject *self = (HeapCTypeObject*)op;
610611
Py_VISIT(Py_TYPE(self));
611612
return 0;
612613
}
613614

614615
static void
615-
heapgcctype_dealloc(HeapCTypeObject *self)
616+
heapgcctype_dealloc(PyObject *op)
616617
{
618+
HeapCTypeObject *self = (HeapCTypeObject*)op;
617619
PyTypeObject *tp = Py_TYPE(self);
618620
PyObject_GC_UnTrack(self);
619621
PyObject_GC_Del(self);
@@ -642,8 +644,9 @@ PyDoc_STRVAR(heapctype__doc__,
642644
"The 'value' attribute is set to 10 in __init__.");
643645

644646
static void
645-
heapctype_dealloc(HeapCTypeObject *self)
647+
heapctype_dealloc(PyObject *op)
646648
{
649+
HeapCTypeObject *self = (HeapCTypeObject *)op;
647650
PyTypeObject *tp = Py_TYPE(self);
648651
PyObject_Free(self);
649652
Py_DECREF(tp);
@@ -716,8 +719,9 @@ typedef struct {
716719
} HeapCTypeWithBufferObject;
717720

718721
static int
719-
heapctypewithbuffer_getbuffer(HeapCTypeWithBufferObject *self, Py_buffer *view, int flags)
722+
heapctypewithbuffer_getbuffer(PyObject *op, Py_buffer *view, int flags)
720723
{
724+
HeapCTypeWithBufferObject *self = (HeapCTypeWithBufferObject *)op;
721725
self->buffer[0] = '1';
722726
self->buffer[1] = '2';
723727
self->buffer[2] = '3';
@@ -727,8 +731,9 @@ heapctypewithbuffer_getbuffer(HeapCTypeWithBufferObject *self, Py_buffer *view,
727731
}
728732

729733
static void
730-
heapctypewithbuffer_releasebuffer(HeapCTypeWithBufferObject *self, Py_buffer *view)
734+
heapctypewithbuffer_releasebuffer(PyObject *op, Py_buffer *view)
731735
{
736+
HeapCTypeWithBufferObject *self = (HeapCTypeWithBufferObject *)op;
732737
assert(view->obj == (void*) self);
733738
}
734739

@@ -873,9 +878,9 @@ typedef struct {
873878
} HeapCTypeWithDictObject;
874879

875880
static void
876-
heapctypewithdict_dealloc(HeapCTypeWithDictObject* self)
881+
heapctypewithdict_dealloc(PyObject *op)
877882
{
878-
883+
HeapCTypeWithDictObject *self = (HeapCTypeWithDictObject*)op;
879884
PyTypeObject *tp = Py_TYPE(self);
880885
Py_XDECREF(self->dict);
881886
PyObject_Free(self);
@@ -917,22 +922,23 @@ static PyType_Spec HeapCTypeWithDict2_spec = {
917922
};
918923

919924
static int
920-
heapmanaged_traverse(HeapCTypeObject *self, visitproc visit, void *arg)
925+
heapmanaged_traverse(PyObject *self, visitproc visit, void *arg)
921926
{
922927
Py_VISIT(Py_TYPE(self));
923928
return PyObject_VisitManagedDict((PyObject *)self, visit, arg);
924929
}
925930

926931
static int
927-
heapmanaged_clear(HeapCTypeObject *self)
932+
heapmanaged_clear(PyObject *self)
928933
{
929-
PyObject_ClearManagedDict((PyObject *)self);
934+
PyObject_ClearManagedDict(self);
930935
return 0;
931936
}
932937

933938
static void
934-
heapmanaged_dealloc(HeapCTypeObject *self)
939+
heapmanaged_dealloc(PyObject *op)
935940
{
941+
HeapCTypeObject *self = (HeapCTypeObject*)op;
936942
PyTypeObject *tp = Py_TYPE(self);
937943
PyObject_ClearManagedDict((PyObject *)self);
938944
PyObject_GC_UnTrack(self);
@@ -1016,9 +1022,9 @@ static struct PyMemberDef heapctypewithweakref_members[] = {
10161022
};
10171023

10181024
static void
1019-
heapctypewithweakref_dealloc(HeapCTypeWithWeakrefObject* self)
1025+
heapctypewithweakref_dealloc(PyObject *op)
10201026
{
1021-
1027+
HeapCTypeWithWeakrefObject *self = (HeapCTypeWithWeakrefObject*)op;
10221028
PyTypeObject *tp = Py_TYPE(self);
10231029
if (self->weakreflist != NULL)
10241030
PyObject_ClearWeakRefs((PyObject *) self);
@@ -1071,16 +1077,18 @@ heapctypesetattr_init(PyObject *self, PyObject *args, PyObject *kwargs)
10711077
}
10721078

10731079
static void
1074-
heapctypesetattr_dealloc(HeapCTypeSetattrObject *self)
1080+
heapctypesetattr_dealloc(PyObject *op)
10751081
{
1082+
HeapCTypeSetattrObject *self = (HeapCTypeSetattrObject*)op;
10761083
PyTypeObject *tp = Py_TYPE(self);
10771084
PyObject_Free(self);
10781085
Py_DECREF(tp);
10791086
}
10801087

10811088
static int
1082-
heapctypesetattr_setattro(HeapCTypeSetattrObject *self, PyObject *attr, PyObject *value)
1089+
heapctypesetattr_setattro(PyObject *op, PyObject *attr, PyObject *value)
10831090
{
1091+
HeapCTypeSetattrObject *self = (HeapCTypeSetattrObject*)op;
10841092
PyObject *svalue = PyUnicode_FromString("value");
10851093
if (svalue == NULL)
10861094
return -1;
@@ -1237,8 +1245,9 @@ HeapCCollection_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
12371245
}
12381246

12391247
static Py_ssize_t
1240-
HeapCCollection_length(PyVarObject *self)
1248+
HeapCCollection_length(PyObject *op)
12411249
{
1250+
PyVarObject *self = (PyVarObject *)op;
12421251
return Py_SIZE(self);
12431252
}
12441253

Modules/_testcapimodule.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2871,8 +2871,9 @@ MyList_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
28712871
}
28722872

28732873
void
2874-
MyList_dealloc(MyListObject* op)
2874+
MyList_dealloc(PyObject *self)
28752875
{
2876+
MyListObject *op = (MyListObject*)self;
28762877
if (op->deallocated) {
28772878
/* We cannot raise exceptions here but we still want the testsuite
28782879
* to fail when we hit this */

Modules/_testlimitedcapi/heaptype_relative.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ make_sized_heaptypes(PyObject *module, PyObject *args)
7777
static PyObject *
7878
var_heaptype_set_data_to_3s(
7979
PyObject *self, PyTypeObject *defining_class,
80-
PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
80+
PyObject * const *args, Py_ssize_t nargs, PyObject *kwnames)
8181
{
8282
void *data_ptr = PyObject_GetTypeData(self, defining_class);
8383
if (!data_ptr) {
@@ -93,7 +93,7 @@ var_heaptype_set_data_to_3s(
9393

9494
static PyObject *
9595
var_heaptype_get_data(PyObject *self, PyTypeObject *defining_class,
96-
PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
96+
PyObject * const *args, Py_ssize_t nargs, PyObject *kwnames)
9797
{
9898
void *data_ptr = PyObject_GetTypeData(self, defining_class);
9999
if (!data_ptr) {

0 commit comments

Comments
 (0)