@@ -18,6 +18,7 @@ typedef struct {
18
18
PyTypeObject * cwr_type ;
19
19
PyTypeObject * cycle_type ;
20
20
PyTypeObject * dropwhile_type ;
21
+ PyTypeObject * filterfalse_type ;
21
22
PyTypeObject * groupby_type ;
22
23
PyTypeObject * _grouper_type ;
23
24
PyTypeObject * permutations_type ;
@@ -69,16 +70,15 @@ class itertools.combinations_with_replacement "cwr_object *" "clinic_state()->cw
69
70
class itertools.permutations "permutationsobject *" "clinic_state()->permutations_type"
70
71
class itertools.accumulate "accumulateobject *" "clinic_state()->accumulate_type"
71
72
class itertools.compress "compressobject *" "clinic_state()->compress_type"
72
- class itertools.filterfalse "filterfalseobject *" "& filterfalse_type"
73
+ class itertools.filterfalse "filterfalseobject *" "clinic_state()-> filterfalse_type"
73
74
class itertools.count "countobject *" "&count_type"
74
75
class itertools.pairwise "pairwiseobject *" "&pairwise_type"
75
76
[clinic start generated code]*/
76
- /*[clinic end generated code: output=da39a3ee5e6b4b0d input=18f0df1fc6fbed08 ]*/
77
+ /*[clinic end generated code: output=da39a3ee5e6b4b0d input=041cf92c608e0a3b ]*/
77
78
78
79
static PyTypeObject teedataobject_type ;
79
80
static PyTypeObject tee_type ;
80
81
static PyTypeObject batched_type ;
81
- static PyTypeObject filterfalse_type ;
82
82
static PyTypeObject count_type ;
83
83
static PyTypeObject pairwise_type ;
84
84
@@ -3978,15 +3978,18 @@ itertools_filterfalse_impl(PyTypeObject *type, PyObject *func, PyObject *seq)
3978
3978
static void
3979
3979
filterfalse_dealloc (filterfalseobject * lz )
3980
3980
{
3981
+ PyTypeObject * tp = Py_TYPE (lz );
3981
3982
PyObject_GC_UnTrack (lz );
3982
3983
Py_XDECREF (lz -> func );
3983
3984
Py_XDECREF (lz -> it );
3984
- Py_TYPE (lz )-> tp_free (lz );
3985
+ tp -> tp_free (lz );
3986
+ Py_DECREF (tp );
3985
3987
}
3986
3988
3987
3989
static int
3988
3990
filterfalse_traverse (filterfalseobject * lz , visitproc visit , void * arg )
3989
3991
{
3992
+ Py_VISIT (Py_TYPE (lz ));
3990
3993
Py_VISIT (lz -> it );
3991
3994
Py_VISIT (lz -> func );
3992
3995
return 0 ;
@@ -4038,48 +4041,25 @@ static PyMethodDef filterfalse_methods[] = {
4038
4041
{NULL , NULL } /* sentinel */
4039
4042
};
4040
4043
4041
- static PyTypeObject filterfalse_type = {
4042
- PyVarObject_HEAD_INIT (NULL , 0 )
4043
- "itertools.filterfalse" , /* tp_name */
4044
- sizeof (filterfalseobject ), /* tp_basicsize */
4045
- 0 , /* tp_itemsize */
4046
- /* methods */
4047
- (destructor )filterfalse_dealloc , /* tp_dealloc */
4048
- 0 , /* tp_vectorcall_offset */
4049
- 0 , /* tp_getattr */
4050
- 0 , /* tp_setattr */
4051
- 0 , /* tp_as_async */
4052
- 0 , /* tp_repr */
4053
- 0 , /* tp_as_number */
4054
- 0 , /* tp_as_sequence */
4055
- 0 , /* tp_as_mapping */
4056
- 0 , /* tp_hash */
4057
- 0 , /* tp_call */
4058
- 0 , /* tp_str */
4059
- PyObject_GenericGetAttr , /* tp_getattro */
4060
- 0 , /* tp_setattro */
4061
- 0 , /* tp_as_buffer */
4062
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
4063
- Py_TPFLAGS_BASETYPE , /* tp_flags */
4064
- itertools_filterfalse__doc__ , /* tp_doc */
4065
- (traverseproc )filterfalse_traverse , /* tp_traverse */
4066
- 0 , /* tp_clear */
4067
- 0 , /* tp_richcompare */
4068
- 0 , /* tp_weaklistoffset */
4069
- PyObject_SelfIter , /* tp_iter */
4070
- (iternextfunc )filterfalse_next , /* tp_iternext */
4071
- filterfalse_methods , /* tp_methods */
4072
- 0 , /* tp_members */
4073
- 0 , /* tp_getset */
4074
- 0 , /* tp_base */
4075
- 0 , /* tp_dict */
4076
- 0 , /* tp_descr_get */
4077
- 0 , /* tp_descr_set */
4078
- 0 , /* tp_dictoffset */
4079
- 0 , /* tp_init */
4080
- 0 , /* tp_alloc */
4081
- itertools_filterfalse , /* tp_new */
4082
- PyObject_GC_Del , /* tp_free */
4044
+ static PyType_Slot filterfalse_slots [] = {
4045
+ {Py_tp_dealloc , filterfalse_dealloc },
4046
+ {Py_tp_getattro , PyObject_GenericGetAttr },
4047
+ {Py_tp_doc , (void * )itertools_filterfalse__doc__ },
4048
+ {Py_tp_traverse , filterfalse_traverse },
4049
+ {Py_tp_iter , PyObject_SelfIter },
4050
+ {Py_tp_iternext , filterfalse_next },
4051
+ {Py_tp_methods , filterfalse_methods },
4052
+ {Py_tp_new , itertools_filterfalse },
4053
+ {Py_tp_free , PyObject_GC_Del },
4054
+ {0 , NULL },
4055
+ };
4056
+
4057
+ static PyType_Spec filterfalse_spec = {
4058
+ .name = "itertools.filterfalse" ,
4059
+ .basicsize = sizeof (filterfalseobject ),
4060
+ .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_BASETYPE |
4061
+ Py_TPFLAGS_IMMUTABLETYPE ),
4062
+ .slots = filterfalse_slots ,
4083
4063
};
4084
4064
4085
4065
@@ -4801,6 +4781,7 @@ itertoolsmodule_traverse(PyObject *mod, visitproc visit, void *arg)
4801
4781
Py_VISIT (state -> cwr_type );
4802
4782
Py_VISIT (state -> cycle_type );
4803
4783
Py_VISIT (state -> dropwhile_type );
4784
+ Py_VISIT (state -> filterfalse_type );
4804
4785
Py_VISIT (state -> groupby_type );
4805
4786
Py_VISIT (state -> _grouper_type );
4806
4787
Py_VISIT (state -> permutations_type );
@@ -4819,6 +4800,7 @@ itertoolsmodule_clear(PyObject *mod)
4819
4800
Py_CLEAR (state -> cwr_type );
4820
4801
Py_CLEAR (state -> cycle_type );
4821
4802
Py_CLEAR (state -> dropwhile_type );
4803
+ Py_CLEAR (state -> filterfalse_type );
4822
4804
Py_CLEAR (state -> groupby_type );
4823
4805
Py_CLEAR (state -> _grouper_type );
4824
4806
Py_CLEAR (state -> permutations_type );
@@ -4854,6 +4836,7 @@ itertoolsmodule_exec(PyObject *mod)
4854
4836
ADD_TYPE (mod , state -> cwr_type , & cwr_spec );
4855
4837
ADD_TYPE (mod , state -> cycle_type , & cycle_spec );
4856
4838
ADD_TYPE (mod , state -> dropwhile_type , & dropwhile_spec );
4839
+ ADD_TYPE (mod , state -> filterfalse_type , & filterfalse_spec );
4857
4840
ADD_TYPE (mod , state -> groupby_type , & groupby_spec );
4858
4841
ADD_TYPE (mod , state -> _grouper_type , & _grouper_spec );
4859
4842
ADD_TYPE (mod , state -> permutations_type , & permutations_spec );
@@ -4864,7 +4847,6 @@ itertoolsmodule_exec(PyObject *mod)
4864
4847
& batched_type ,
4865
4848
& islice_type ,
4866
4849
& chain_type ,
4867
- & filterfalse_type ,
4868
4850
& count_type ,
4869
4851
& ziplongest_type ,
4870
4852
& pairwise_type ,
0 commit comments