https://github.com/python/cpython/commit/0b6e98c8417316a1692bfb98eaea7c44194dcf8d commit: 0b6e98c8417316a1692bfb98eaea7c44194dcf8d branch: main author: Victor Stinner <vstin...@python.org> committer: vstinner <vstin...@python.org> date: 2025-03-04T10:33:45+01:00 summary:
gh-111178: Fix function signatures in structseq.c (#130683) files: M Objects/structseq.c diff --git a/Objects/structseq.c b/Objects/structseq.c index 56a7851b98788d..b62317e1cf3732 100644 --- a/Objects/structseq.c +++ b/Objects/structseq.c @@ -108,8 +108,9 @@ PyStructSequence_GetItem(PyObject *op, Py_ssize_t index) static int -structseq_traverse(PyStructSequence *obj, visitproc visit, void *arg) +structseq_traverse(PyObject *op, visitproc visit, void *arg) { + PyStructSequence *obj = (PyStructSequence *)op; if (Py_TYPE(obj)->tp_flags & Py_TPFLAGS_HEAPTYPE) { Py_VISIT(Py_TYPE(obj)); } @@ -122,8 +123,9 @@ structseq_traverse(PyStructSequence *obj, visitproc visit, void *arg) } static void -structseq_dealloc(PyStructSequence *obj) +structseq_dealloc(PyObject *op) { + PyStructSequence *obj = (PyStructSequence *)op; Py_ssize_t i, size; PyObject_GC_UnTrack(obj); @@ -263,8 +265,9 @@ structseq_new_impl(PyTypeObject *type, PyObject *arg, PyObject *dict) static PyObject * -structseq_repr(PyStructSequence *obj) +structseq_repr(PyObject *op) { + PyStructSequence *obj = (PyStructSequence *)op; PyTypeObject *typ = Py_TYPE(obj); // count 5 characters per item: "x=1, " @@ -568,14 +571,14 @@ initialize_static_fields(PyTypeObject *type, PyStructSequence_Desc *desc, Py_ssize_t n_hidden = n_members - desc->n_in_sequence; type->tp_basicsize = sizeof(PyStructSequence) + (n_hidden - 1) * sizeof(PyObject *); type->tp_itemsize = sizeof(PyObject *); - type->tp_dealloc = (destructor)structseq_dealloc; - type->tp_repr = (reprfunc)structseq_repr; + type->tp_dealloc = structseq_dealloc; + type->tp_repr = structseq_repr; type->tp_doc = desc->doc; type->tp_base = &PyTuple_Type; type->tp_methods = structseq_methods; type->tp_new = structseq_new; type->tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | tp_flags; - type->tp_traverse = (traverseproc) structseq_traverse; + type->tp_traverse = structseq_traverse; type->tp_members = tp_members; } @@ -745,13 +748,13 @@ _PyStructSequence_NewType(PyStructSequence_Desc *desc, unsigned long tp_flags) } /* Initialize Slots */ - slots[0] = (PyType_Slot){Py_tp_dealloc, (destructor)structseq_dealloc}; - slots[1] = (PyType_Slot){Py_tp_repr, (reprfunc)structseq_repr}; + slots[0] = (PyType_Slot){Py_tp_dealloc, structseq_dealloc}; + slots[1] = (PyType_Slot){Py_tp_repr, structseq_repr}; slots[2] = (PyType_Slot){Py_tp_doc, (void *)desc->doc}; slots[3] = (PyType_Slot){Py_tp_methods, structseq_methods}; slots[4] = (PyType_Slot){Py_tp_new, structseq_new}; slots[5] = (PyType_Slot){Py_tp_members, members}; - slots[6] = (PyType_Slot){Py_tp_traverse, (traverseproc)structseq_traverse}; + slots[6] = (PyType_Slot){Py_tp_traverse, structseq_traverse}; slots[7] = (PyType_Slot){0, 0}; /* Initialize Spec */ _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com