@@ -108,8 +108,9 @@ PyStructSequence_GetItem(PyObject *op, Py_ssize_t index)
108
108
109
109
110
110
static int
111
- structseq_traverse (PyStructSequence * obj , visitproc visit , void * arg )
111
+ structseq_traverse (PyObject * op , visitproc visit , void * arg )
112
112
{
113
+ PyStructSequence * obj = (PyStructSequence * )op ;
113
114
if (Py_TYPE (obj )-> tp_flags & Py_TPFLAGS_HEAPTYPE ) {
114
115
Py_VISIT (Py_TYPE (obj ));
115
116
}
@@ -122,8 +123,9 @@ structseq_traverse(PyStructSequence *obj, visitproc visit, void *arg)
122
123
}
123
124
124
125
static void
125
- structseq_dealloc (PyStructSequence * obj )
126
+ structseq_dealloc (PyObject * op )
126
127
{
128
+ PyStructSequence * obj = (PyStructSequence * )op ;
127
129
Py_ssize_t i , size ;
128
130
PyObject_GC_UnTrack (obj );
129
131
@@ -263,8 +265,9 @@ structseq_new_impl(PyTypeObject *type, PyObject *arg, PyObject *dict)
263
265
264
266
265
267
static PyObject *
266
- structseq_repr (PyStructSequence * obj )
268
+ structseq_repr (PyObject * op )
267
269
{
270
+ PyStructSequence * obj = (PyStructSequence * )op ;
268
271
PyTypeObject * typ = Py_TYPE (obj );
269
272
270
273
// count 5 characters per item: "x=1, "
@@ -568,14 +571,14 @@ initialize_static_fields(PyTypeObject *type, PyStructSequence_Desc *desc,
568
571
Py_ssize_t n_hidden = n_members - desc -> n_in_sequence ;
569
572
type -> tp_basicsize = sizeof (PyStructSequence ) + (n_hidden - 1 ) * sizeof (PyObject * );
570
573
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 ;
573
576
type -> tp_doc = desc -> doc ;
574
577
type -> tp_base = & PyTuple_Type ;
575
578
type -> tp_methods = structseq_methods ;
576
579
type -> tp_new = structseq_new ;
577
580
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 ;
579
582
type -> tp_members = tp_members ;
580
583
}
581
584
@@ -745,13 +748,13 @@ _PyStructSequence_NewType(PyStructSequence_Desc *desc, unsigned long tp_flags)
745
748
}
746
749
747
750
/* 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 };
750
753
slots [2 ] = (PyType_Slot ){Py_tp_doc , (void * )desc -> doc };
751
754
slots [3 ] = (PyType_Slot ){Py_tp_methods , structseq_methods };
752
755
slots [4 ] = (PyType_Slot ){Py_tp_new , structseq_new };
753
756
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 };
755
758
slots [7 ] = (PyType_Slot ){0 , 0 };
756
759
757
760
/* Initialize Spec */
0 commit comments