Skip to content

Commit 0b6e98c

Browse files
authored
gh-111178: Fix function signatures in structseq.c (#130683)
1 parent ed8675c commit 0b6e98c

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

Objects/structseq.c

+12-9
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,9 @@ PyStructSequence_GetItem(PyObject *op, Py_ssize_t index)
108108

109109

110110
static int
111-
structseq_traverse(PyStructSequence *obj, visitproc visit, void *arg)
111+
structseq_traverse(PyObject *op, visitproc visit, void *arg)
112112
{
113+
PyStructSequence *obj = (PyStructSequence *)op;
113114
if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_HEAPTYPE) {
114115
Py_VISIT(Py_TYPE(obj));
115116
}
@@ -122,8 +123,9 @@ structseq_traverse(PyStructSequence *obj, visitproc visit, void *arg)
122123
}
123124

124125
static void
125-
structseq_dealloc(PyStructSequence *obj)
126+
structseq_dealloc(PyObject *op)
126127
{
128+
PyStructSequence *obj = (PyStructSequence *)op;
127129
Py_ssize_t i, size;
128130
PyObject_GC_UnTrack(obj);
129131

@@ -263,8 +265,9 @@ structseq_new_impl(PyTypeObject *type, PyObject *arg, PyObject *dict)
263265

264266

265267
static PyObject *
266-
structseq_repr(PyStructSequence *obj)
268+
structseq_repr(PyObject *op)
267269
{
270+
PyStructSequence *obj = (PyStructSequence *)op;
268271
PyTypeObject *typ = Py_TYPE(obj);
269272

270273
// count 5 characters per item: "x=1, "
@@ -568,14 +571,14 @@ initialize_static_fields(PyTypeObject *type, PyStructSequence_Desc *desc,
568571
Py_ssize_t n_hidden = n_members - desc->n_in_sequence;
569572
type->tp_basicsize = sizeof(PyStructSequence) + (n_hidden - 1) * sizeof(PyObject *);
570573
type->tp_itemsize = sizeof(PyObject *);
571-
type->tp_dealloc = (destructor)structseq_dealloc;
572-
type->tp_repr = (reprfunc)structseq_repr;
574+
type->tp_dealloc = structseq_dealloc;
575+
type->tp_repr = structseq_repr;
573576
type->tp_doc = desc->doc;
574577
type->tp_base = &PyTuple_Type;
575578
type->tp_methods = structseq_methods;
576579
type->tp_new = structseq_new;
577580
type->tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | tp_flags;
578-
type->tp_traverse = (traverseproc) structseq_traverse;
581+
type->tp_traverse = structseq_traverse;
579582
type->tp_members = tp_members;
580583
}
581584

@@ -745,13 +748,13 @@ _PyStructSequence_NewType(PyStructSequence_Desc *desc, unsigned long tp_flags)
745748
}
746749

747750
/* Initialize Slots */
748-
slots[0] = (PyType_Slot){Py_tp_dealloc, (destructor)structseq_dealloc};
749-
slots[1] = (PyType_Slot){Py_tp_repr, (reprfunc)structseq_repr};
751+
slots[0] = (PyType_Slot){Py_tp_dealloc, structseq_dealloc};
752+
slots[1] = (PyType_Slot){Py_tp_repr, structseq_repr};
750753
slots[2] = (PyType_Slot){Py_tp_doc, (void *)desc->doc};
751754
slots[3] = (PyType_Slot){Py_tp_methods, structseq_methods};
752755
slots[4] = (PyType_Slot){Py_tp_new, structseq_new};
753756
slots[5] = (PyType_Slot){Py_tp_members, members};
754-
slots[6] = (PyType_Slot){Py_tp_traverse, (traverseproc)structseq_traverse};
757+
slots[6] = (PyType_Slot){Py_tp_traverse, structseq_traverse};
755758
slots[7] = (PyType_Slot){0, 0};
756759

757760
/* Initialize Spec */

0 commit comments

Comments
 (0)