@@ -15,6 +15,7 @@ typedef struct {
15
15
PyTypeObject * dropwhile_type ;
16
16
PyTypeObject * groupby_type ;
17
17
PyTypeObject * _grouper_type ;
18
+ PyTypeObject * starmap_type ;
18
19
PyTypeObject * takewhile_type ;
19
20
} itertools_state ;
20
21
@@ -46,7 +47,7 @@ class itertools.batched "batchedobject *" "&batched_type"
46
47
class itertools.cycle "cycleobject *" "clinic_state()->cycle_type"
47
48
class itertools.dropwhile "dropwhileobject *" "clinic_state()->dropwhile_type"
48
49
class itertools.takewhile "takewhileobject *" "clinic_state()->takewhile_type"
49
- class itertools.starmap "starmapobject *" "& starmap_type"
50
+ class itertools.starmap "starmapobject *" "clinic_state()-> starmap_type"
50
51
class itertools.chain "chainobject *" "&chain_type"
51
52
class itertools.combinations "combinationsobject *" "&combinations_type"
52
53
class itertools.combinations_with_replacement "cwr_object *" "&cwr_type"
@@ -57,12 +58,11 @@ class itertools.filterfalse "filterfalseobject *" "&filterfalse_type"
57
58
class itertools.count "countobject *" "&count_type"
58
59
class itertools.pairwise "pairwiseobject *" "&pairwise_type"
59
60
[clinic start generated code]*/
60
- /*[clinic end generated code: output=da39a3ee5e6b4b0d input=3015dff7a88cfc00 ]*/
61
+ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=3b9f0718b7d49b01 ]*/
61
62
62
63
static PyTypeObject teedataobject_type ;
63
64
static PyTypeObject tee_type ;
64
65
static PyTypeObject batched_type ;
65
- static PyTypeObject starmap_type ;
66
66
static PyTypeObject combinations_type ;
67
67
static PyTypeObject cwr_type ;
68
68
static PyTypeObject permutations_type ;
@@ -1978,15 +1978,18 @@ itertools_starmap_impl(PyTypeObject *type, PyObject *func, PyObject *seq)
1978
1978
static void
1979
1979
starmap_dealloc (starmapobject * lz )
1980
1980
{
1981
+ PyTypeObject * tp = Py_TYPE (lz );
1981
1982
PyObject_GC_UnTrack (lz );
1982
1983
Py_XDECREF (lz -> func );
1983
1984
Py_XDECREF (lz -> it );
1984
- Py_TYPE (lz )-> tp_free (lz );
1985
+ tp -> tp_free (lz );
1986
+ Py_DECREF (tp );
1985
1987
}
1986
1988
1987
1989
static int
1988
1990
starmap_traverse (starmapobject * lz , visitproc visit , void * arg )
1989
1991
{
1992
+ Py_VISIT (Py_TYPE (lz ));
1990
1993
Py_VISIT (lz -> it );
1991
1994
Py_VISIT (lz -> func );
1992
1995
return 0 ;
@@ -2027,48 +2030,25 @@ static PyMethodDef starmap_methods[] = {
2027
2030
{NULL , NULL } /* sentinel */
2028
2031
};
2029
2032
2030
- static PyTypeObject starmap_type = {
2031
- PyVarObject_HEAD_INIT (NULL , 0 )
2032
- "itertools.starmap" , /* tp_name */
2033
- sizeof (starmapobject ), /* tp_basicsize */
2034
- 0 , /* tp_itemsize */
2035
- /* methods */
2036
- (destructor )starmap_dealloc , /* tp_dealloc */
2037
- 0 , /* tp_vectorcall_offset */
2038
- 0 , /* tp_getattr */
2039
- 0 , /* tp_setattr */
2040
- 0 , /* tp_as_async */
2041
- 0 , /* tp_repr */
2042
- 0 , /* tp_as_number */
2043
- 0 , /* tp_as_sequence */
2044
- 0 , /* tp_as_mapping */
2045
- 0 , /* tp_hash */
2046
- 0 , /* tp_call */
2047
- 0 , /* tp_str */
2048
- PyObject_GenericGetAttr , /* tp_getattro */
2049
- 0 , /* tp_setattro */
2050
- 0 , /* tp_as_buffer */
2051
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
2052
- Py_TPFLAGS_BASETYPE , /* tp_flags */
2053
- itertools_starmap__doc__ , /* tp_doc */
2054
- (traverseproc )starmap_traverse , /* tp_traverse */
2055
- 0 , /* tp_clear */
2056
- 0 , /* tp_richcompare */
2057
- 0 , /* tp_weaklistoffset */
2058
- PyObject_SelfIter , /* tp_iter */
2059
- (iternextfunc )starmap_next , /* tp_iternext */
2060
- starmap_methods , /* tp_methods */
2061
- 0 , /* tp_members */
2062
- 0 , /* tp_getset */
2063
- 0 , /* tp_base */
2064
- 0 , /* tp_dict */
2065
- 0 , /* tp_descr_get */
2066
- 0 , /* tp_descr_set */
2067
- 0 , /* tp_dictoffset */
2068
- 0 , /* tp_init */
2069
- 0 , /* tp_alloc */
2070
- itertools_starmap , /* tp_new */
2071
- PyObject_GC_Del , /* tp_free */
2033
+ static PyType_Slot starmap_slots [] = {
2034
+ {Py_tp_dealloc , starmap_dealloc },
2035
+ {Py_tp_getattro , PyObject_GenericGetAttr },
2036
+ {Py_tp_doc , (void * )itertools_starmap__doc__ },
2037
+ {Py_tp_traverse , starmap_traverse },
2038
+ {Py_tp_iter , PyObject_SelfIter },
2039
+ {Py_tp_iternext , starmap_next },
2040
+ {Py_tp_methods , starmap_methods },
2041
+ {Py_tp_new , itertools_starmap },
2042
+ {Py_tp_free , PyObject_GC_Del },
2043
+ {0 , NULL },
2044
+ };
2045
+
2046
+ static PyType_Spec starmap_spec = {
2047
+ .name = "itertools.starmap" ,
2048
+ .basicsize = sizeof (starmapobject ),
2049
+ .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE |
2050
+ Py_TPFLAGS_IMMUTABLETYPE ),
2051
+ .slots = starmap_slots ,
2072
2052
};
2073
2053
2074
2054
@@ -4905,6 +4885,7 @@ itertoolsmodule_traverse(PyObject *mod, visitproc visit, void *arg)
4905
4885
Py_VISIT (state -> dropwhile_type );
4906
4886
Py_VISIT (state -> groupby_type );
4907
4887
Py_VISIT (state -> _grouper_type );
4888
+ Py_VISIT (state -> starmap_type );
4908
4889
Py_VISIT (state -> takewhile_type );
4909
4890
return 0 ;
4910
4891
}
@@ -4917,6 +4898,7 @@ itertoolsmodule_clear(PyObject *mod)
4917
4898
Py_CLEAR (state -> dropwhile_type );
4918
4899
Py_CLEAR (state -> groupby_type );
4919
4900
Py_CLEAR (state -> _grouper_type );
4901
+ Py_CLEAR (state -> starmap_type );
4920
4902
Py_CLEAR (state -> takewhile_type );
4921
4903
return 0 ;
4922
4904
}
@@ -4946,6 +4928,7 @@ itertoolsmodule_exec(PyObject *mod)
4946
4928
ADD_TYPE (mod , state -> dropwhile_type , & dropwhile_spec );
4947
4929
ADD_TYPE (mod , state -> groupby_type , & groupby_spec );
4948
4930
ADD_TYPE (mod , state -> _grouper_type , & _grouper_spec );
4931
+ ADD_TYPE (mod , state -> starmap_type , & starmap_spec );
4949
4932
ADD_TYPE (mod , state -> takewhile_type , & takewhile_spec );
4950
4933
4951
4934
PyTypeObject * typelist [] = {
@@ -4954,7 +4937,6 @@ itertoolsmodule_exec(PyObject *mod)
4954
4937
& combinations_type ,
4955
4938
& cwr_type ,
4956
4939
& islice_type ,
4957
- & starmap_type ,
4958
4940
& chain_type ,
4959
4941
& compress_type ,
4960
4942
& filterfalse_type ,
0 commit comments