@@ -2978,6 +2978,8 @@ typedef struct {
29782978 int strict ;
29792979} zipobject ;
29802980
2981+ #define _zipobject_CAST (op ) ((zipobject *)(op))
2982+
29812983static PyObject *
29822984zip_new (PyTypeObject * type , PyObject * args , PyObject * kwds )
29832985{
@@ -3046,25 +3048,29 @@ zip_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
30463048}
30473049
30483050static void
3049- zip_dealloc (zipobject * lz )
3051+ zip_dealloc (PyObject * self )
30503052{
3053+ zipobject * lz = _zipobject_CAST (self );
30513054 PyObject_GC_UnTrack (lz );
30523055 Py_XDECREF (lz -> ittuple );
30533056 Py_XDECREF (lz -> result );
30543057 Py_TYPE (lz )-> tp_free (lz );
30553058}
30563059
30573060static int
3058- zip_traverse (zipobject * lz , visitproc visit , void * arg )
3061+ zip_traverse (PyObject * self , visitproc visit , void * arg )
30593062{
3063+ zipobject * lz = _zipobject_CAST (self );
30603064 Py_VISIT (lz -> ittuple );
30613065 Py_VISIT (lz -> result );
30623066 return 0 ;
30633067}
30643068
30653069static PyObject *
3066- zip_next (zipobject * lz )
3070+ zip_next (PyObject * self )
30673071{
3072+ zipobject * lz = _zipobject_CAST (self );
3073+
30683074 Py_ssize_t i ;
30693075 Py_ssize_t tuplesize = lz -> tuplesize ;
30703076 PyObject * result = lz -> result ;
@@ -3154,8 +3160,9 @@ zip_next(zipobject *lz)
31543160}
31553161
31563162static PyObject *
3157- zip_reduce (zipobject * lz , PyObject * Py_UNUSED (ignored ))
3163+ zip_reduce (PyObject * self , PyObject * Py_UNUSED (ignored ))
31583164{
3165+ zipobject * lz = _zipobject_CAST (self );
31593166 /* Just recreate the zip with the internal iterator tuple */
31603167 if (lz -> strict ) {
31613168 return PyTuple_Pack (3 , Py_TYPE (lz ), lz -> ittuple , Py_True );
@@ -3164,19 +3171,20 @@ zip_reduce(zipobject *lz, PyObject *Py_UNUSED(ignored))
31643171}
31653172
31663173static PyObject *
3167- zip_setstate (zipobject * lz , PyObject * state )
3174+ zip_setstate (PyObject * self , PyObject * state )
31683175{
31693176 int strict = PyObject_IsTrue (state );
31703177 if (strict < 0 ) {
31713178 return NULL ;
31723179 }
3180+ zipobject * lz = _zipobject_CAST (self );
31733181 lz -> strict = strict ;
31743182 Py_RETURN_NONE ;
31753183}
31763184
31773185static PyMethodDef zip_methods [] = {
3178- {"__reduce__" , _PyCFunction_CAST ( zip_reduce ) , METH_NOARGS , reduce_doc },
3179- {"__setstate__" , _PyCFunction_CAST ( zip_setstate ) , METH_O , setstate_doc },
3186+ {"__reduce__" , zip_reduce , METH_NOARGS , reduce_doc },
3187+ {"__setstate__" , zip_setstate , METH_O , setstate_doc },
31803188 {NULL } /* sentinel */
31813189};
31823190
@@ -3201,7 +3209,7 @@ PyTypeObject PyZip_Type = {
32013209 sizeof (zipobject ), /* tp_basicsize */
32023210 0 , /* tp_itemsize */
32033211 /* methods */
3204- ( destructor ) zip_dealloc , /* tp_dealloc */
3212+ zip_dealloc , /* tp_dealloc */
32053213 0 , /* tp_vectorcall_offset */
32063214 0 , /* tp_getattr */
32073215 0 , /* tp_setattr */
@@ -3219,12 +3227,12 @@ PyTypeObject PyZip_Type = {
32193227 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
32203228 Py_TPFLAGS_BASETYPE , /* tp_flags */
32213229 zip_doc , /* tp_doc */
3222- ( traverseproc ) zip_traverse , /* tp_traverse */
3230+ zip_traverse , /* tp_traverse */
32233231 0 , /* tp_clear */
32243232 0 , /* tp_richcompare */
32253233 0 , /* tp_weaklistoffset */
32263234 PyObject_SelfIter , /* tp_iter */
3227- ( iternextfunc ) zip_next , /* tp_iternext */
3235+ zip_next , /* tp_iternext */
32283236 zip_methods , /* tp_methods */
32293237 0 , /* tp_members */
32303238 0 , /* tp_getset */
0 commit comments