@@ -248,12 +248,32 @@ _io_IncrementalNewlineDecoder___init___impl(nldecoder_object *self,
248
248
return 0 ;
249
249
}
250
250
251
- static void
252
- incrementalnewlinedecoder_dealloc (nldecoder_object * self )
251
+ static int
252
+ incrementalnewlinedecoder_traverse (nldecoder_object * self , visitproc visit ,
253
+ void * arg )
254
+ {
255
+ Py_VISIT (Py_TYPE (self ));
256
+ Py_VISIT (self -> decoder );
257
+ Py_VISIT (self -> errors );
258
+ return 0 ;
259
+ }
260
+
261
+ static int
262
+ incrementalnewlinedecoder_clear (nldecoder_object * self )
253
263
{
254
264
Py_CLEAR (self -> decoder );
255
265
Py_CLEAR (self -> errors );
256
- Py_TYPE (self )-> tp_free ((PyObject * )self );
266
+ return 0 ;
267
+ }
268
+
269
+ static void
270
+ incrementalnewlinedecoder_dealloc (nldecoder_object * self )
271
+ {
272
+ PyTypeObject * tp = Py_TYPE (self );
273
+ _PyObject_GC_UNTRACK (self );
274
+ (void )incrementalnewlinedecoder_clear (self );
275
+ tp -> tp_free ((PyObject * )self );
276
+ Py_DECREF (tp );
257
277
}
258
278
259
279
static int
@@ -3176,45 +3196,23 @@ static PyGetSetDef incrementalnewlinedecoder_getset[] = {
3176
3196
{NULL }
3177
3197
};
3178
3198
3179
- PyTypeObject PyIncrementalNewlineDecoder_Type = {
3180
- PyVarObject_HEAD_INIT (NULL , 0 )
3181
- "_io.IncrementalNewlineDecoder" , /*tp_name*/
3182
- sizeof (nldecoder_object ), /*tp_basicsize*/
3183
- 0 , /*tp_itemsize*/
3184
- (destructor )incrementalnewlinedecoder_dealloc , /*tp_dealloc*/
3185
- 0 , /*tp_vectorcall_offset*/
3186
- 0 , /*tp_getattr*/
3187
- 0 , /*tp_setattr*/
3188
- 0 , /*tp_as_async*/
3189
- 0 , /*tp_repr*/
3190
- 0 , /*tp_as_number*/
3191
- 0 , /*tp_as_sequence*/
3192
- 0 , /*tp_as_mapping*/
3193
- 0 , /*tp_hash */
3194
- 0 , /*tp_call*/
3195
- 0 , /*tp_str*/
3196
- 0 , /*tp_getattro*/
3197
- 0 , /*tp_setattro*/
3198
- 0 , /*tp_as_buffer*/
3199
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE , /*tp_flags*/
3200
- _io_IncrementalNewlineDecoder___init____doc__ , /* tp_doc */
3201
- 0 , /* tp_traverse */
3202
- 0 , /* tp_clear */
3203
- 0 , /* tp_richcompare */
3204
- 0 , /*tp_weaklistoffset*/
3205
- 0 , /* tp_iter */
3206
- 0 , /* tp_iternext */
3207
- incrementalnewlinedecoder_methods , /* tp_methods */
3208
- 0 , /* tp_members */
3209
- incrementalnewlinedecoder_getset , /* tp_getset */
3210
- 0 , /* tp_base */
3211
- 0 , /* tp_dict */
3212
- 0 , /* tp_descr_get */
3213
- 0 , /* tp_descr_set */
3214
- 0 , /* tp_dictoffset */
3215
- _io_IncrementalNewlineDecoder___init__ , /* tp_init */
3216
- 0 , /* tp_alloc */
3217
- PyType_GenericNew , /* tp_new */
3199
+ static PyType_Slot nldecoder_slots [] = {
3200
+ {Py_tp_dealloc , incrementalnewlinedecoder_dealloc },
3201
+ {Py_tp_doc , (void * )_io_IncrementalNewlineDecoder___init____doc__ },
3202
+ {Py_tp_methods , incrementalnewlinedecoder_methods },
3203
+ {Py_tp_getset , incrementalnewlinedecoder_getset },
3204
+ {Py_tp_traverse , incrementalnewlinedecoder_traverse },
3205
+ {Py_tp_clear , incrementalnewlinedecoder_clear },
3206
+ {Py_tp_init , _io_IncrementalNewlineDecoder___init__ },
3207
+ {0 , NULL },
3208
+ };
3209
+
3210
+ PyType_Spec nldecoder_spec = {
3211
+ .name = "_io.IncrementalNewlineDecoder" ,
3212
+ .basicsize = sizeof (nldecoder_object ),
3213
+ .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC |
3214
+ Py_TPFLAGS_IMMUTABLETYPE ),
3215
+ .slots = nldecoder_slots ,
3218
3216
};
3219
3217
3220
3218
0 commit comments