@@ -381,14 +381,13 @@ _bz2_BZ2Compressor_impl(PyTypeObject *type, int compresslevel)
381381static void
382382BZ2Compressor_dealloc (PyObject * op )
383383{
384- PyTypeObject * tp = Py_TYPE (op );
385- PyObject_GC_UnTrack (op );
386384 BZ2Compressor * self = _BZ2Compressor_CAST (op );
387385 BZ2_bzCompressEnd (& self -> bzs );
388386 if (self -> lock != NULL ) {
389387 PyThread_free_lock (self -> lock );
390388 }
391- tp -> tp_free (self );
389+ PyTypeObject * tp = Py_TYPE (self );
390+ tp -> tp_free ((PyObject * )self );
392391 Py_DECREF (tp );
393392}
394393
@@ -421,7 +420,7 @@ static PyType_Spec bz2_compressor_type_spec = {
421420 // bz2_compressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
422421 // which prevents to create a subclass.
423422 // So calling PyType_GetModuleState() in this file is always safe.
424- .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC ),
423+ .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE ),
425424 .slots = bz2_compressor_type_slots ,
426425};
427426
@@ -688,19 +687,19 @@ _bz2_BZ2Decompressor_impl(PyTypeObject *type)
688687static void
689688BZ2Decompressor_dealloc (PyObject * op )
690689{
691- PyTypeObject * tp = Py_TYPE (op );
692- PyObject_GC_UnTrack (op );
693690 BZ2Decompressor * self = _BZ2Decompressor_CAST (op );
694691
695- if (self -> input_buffer != NULL ) {
692+ if (self -> input_buffer != NULL ) {
696693 PyMem_Free (self -> input_buffer );
697694 }
698695 BZ2_bzDecompressEnd (& self -> bzs );
699696 Py_CLEAR (self -> unused_data );
700697 if (self -> lock != NULL ) {
701698 PyThread_free_lock (self -> lock );
702699 }
703- tp -> tp_free (self );
700+
701+ PyTypeObject * tp = Py_TYPE (self );
702+ tp -> tp_free ((PyObject * )self );
704703 Py_DECREF (tp );
705704}
706705
@@ -752,7 +751,7 @@ static PyType_Spec bz2_decompressor_type_spec = {
752751 // bz2_decompressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
753752 // which prevents to create a subclass.
754753 // So calling PyType_GetModuleState() in this file is always safe.
755- .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC ),
754+ .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE ),
756755 .slots = bz2_decompressor_type_slots ,
757756};
758757
0 commit comments