@@ -866,12 +866,13 @@ Compressor_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
866
866
static void
867
867
Compressor_dealloc (PyObject * op )
868
868
{
869
+ PyTypeObject * tp = Py_TYPE (op );
870
+ PyObject_GC_UnTrack (op );
869
871
Compressor * self = Compressor_CAST (op );
870
872
lzma_end (& self -> lzs );
871
873
if (self -> lock != NULL ) {
872
874
PyThread_free_lock (self -> lock );
873
875
}
874
- PyTypeObject * tp = Py_TYPE (self );
875
876
tp -> tp_free (self );
876
877
Py_DECREF (tp );
877
878
}
@@ -933,7 +934,7 @@ static PyType_Spec lzma_compressor_type_spec = {
933
934
// lzma_compressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
934
935
// which prevents to create a subclass.
935
936
// So calling PyType_GetModuleState() in this file is always safe.
936
- .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE ),
937
+ .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC ),
937
938
.slots = lzma_compressor_type_slots ,
938
939
};
939
940
@@ -1314,6 +1315,8 @@ _lzma_LZMADecompressor_impl(PyTypeObject *type, int format,
1314
1315
static void
1315
1316
Decompressor_dealloc (PyObject * op )
1316
1317
{
1318
+ PyTypeObject * tp = Py_TYPE (op );
1319
+ PyObject_GC_UnTrack (op );
1317
1320
Decompressor * self = Decompressor_CAST (op );
1318
1321
if (self -> input_buffer != NULL )
1319
1322
PyMem_Free (self -> input_buffer );
@@ -1323,7 +1326,6 @@ Decompressor_dealloc(PyObject *op)
1323
1326
if (self -> lock != NULL ) {
1324
1327
PyThread_free_lock (self -> lock );
1325
1328
}
1326
- PyTypeObject * tp = Py_TYPE (self );
1327
1329
tp -> tp_free (self );
1328
1330
Py_DECREF (tp );
1329
1331
}
@@ -1381,7 +1383,7 @@ static PyType_Spec lzma_decompressor_type_spec = {
1381
1383
// lzma_decompressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
1382
1384
// which prevents to create a subclass.
1383
1385
// So calling PyType_GetModuleState() in this file is always safe.
1384
- .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE ),
1386
+ .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC ),
1385
1387
.slots = lzma_decompressor_type_slots ,
1386
1388
};
1387
1389
0 commit comments