@@ -126,9 +126,6 @@ typedef struct {
126126 PyThread_type_lock lock ;
127127} Decompressor ;
128128
129- #define Compressor_CAST (op ) ((Compressor *)(op))
130- #define Decompressor_CAST (op ) ((Decompressor *)(op))
131-
132129/* Helper functions. */
133130
134131static int
@@ -860,16 +857,14 @@ Compressor_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
860857}
861858
862859static void
863- Compressor_dealloc (PyObject * op )
860+ Compressor_dealloc (Compressor * self )
864861{
865- PyTypeObject * tp = Py_TYPE (op );
866- PyObject_GC_UnTrack (op );
867- Compressor * self = Compressor_CAST (op );
868862 lzma_end (& self -> lzs );
869863 if (self -> lock != NULL ) {
870864 PyThread_free_lock (self -> lock );
871865 }
872- tp -> tp_free (self );
866+ PyTypeObject * tp = Py_TYPE (self );
867+ tp -> tp_free ((PyObject * )self );
873868 Py_DECREF (tp );
874869}
875870
@@ -880,7 +875,7 @@ static PyMethodDef Compressor_methods[] = {
880875};
881876
882877static int
883- Compressor_traverse (PyObject * self , visitproc visit , void * arg )
878+ Compressor_traverse (Compressor * self , visitproc visit , void * arg )
884879{
885880 Py_VISIT (Py_TYPE (self ));
886881 return 0 ;
@@ -930,7 +925,7 @@ static PyType_Spec lzma_compressor_type_spec = {
930925 // lzma_compressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
931926 // which prevents to create a subclass.
932927 // So calling PyType_GetModuleState() in this file is always safe.
933- .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC ),
928+ .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE ),
934929 .slots = lzma_compressor_type_slots ,
935930};
936931
@@ -1309,11 +1304,8 @@ _lzma_LZMADecompressor_impl(PyTypeObject *type, int format,
13091304}
13101305
13111306static void
1312- Decompressor_dealloc (PyObject * op )
1307+ Decompressor_dealloc (Decompressor * self )
13131308{
1314- PyTypeObject * tp = Py_TYPE (op );
1315- PyObject_GC_UnTrack (op );
1316- Decompressor * self = Decompressor_CAST (op );
13171309 if (self -> input_buffer != NULL )
13181310 PyMem_Free (self -> input_buffer );
13191311
@@ -1322,12 +1314,13 @@ Decompressor_dealloc(PyObject *op)
13221314 if (self -> lock != NULL ) {
13231315 PyThread_free_lock (self -> lock );
13241316 }
1325- tp -> tp_free (self );
1317+ PyTypeObject * tp = Py_TYPE (self );
1318+ tp -> tp_free ((PyObject * )self );
13261319 Py_DECREF (tp );
13271320}
13281321
13291322static int
1330- Decompressor_traverse (PyObject * self , visitproc visit , void * arg )
1323+ Decompressor_traverse (Decompressor * self , visitproc visit , void * arg )
13311324{
13321325 Py_VISIT (Py_TYPE (self ));
13331326 return 0 ;
@@ -1379,7 +1372,7 @@ static PyType_Spec lzma_decompressor_type_spec = {
13791372 // lzma_decompressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
13801373 // which prevents to create a subclass.
13811374 // So calling PyType_GetModuleState() in this file is always safe.
1382- .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC ),
1375+ .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE ),
13831376 .slots = lzma_decompressor_type_slots ,
13841377};
13851378
0 commit comments