mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-111178: Fix function signatures in structseq.c (#130683)
This commit is contained in:
parent
ed8675c571
commit
0b6e98c841
1 changed files with 12 additions and 9 deletions
|
@ -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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue