Skip to content

Commit fa86d1d

Browse files
committed
Revert "gh-116946: fully implement GC protocol for lzma objects (#138288)"
This reverts commit 3ea16f9.
1 parent 131bab6 commit fa86d1d

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Modules/_lzmamodule.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -866,13 +866,12 @@ Compressor_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
866866
static void
867867
Compressor_dealloc(PyObject *op)
868868
{
869-
PyTypeObject *tp = Py_TYPE(op);
870-
PyObject_GC_UnTrack(op);
871869
Compressor *self = Compressor_CAST(op);
872870
lzma_end(&self->lzs);
873871
if (self->lock != NULL) {
874872
PyThread_free_lock(self->lock);
875873
}
874+
PyTypeObject *tp = Py_TYPE(self);
876875
tp->tp_free(self);
877876
Py_DECREF(tp);
878877
}
@@ -934,7 +933,7 @@ static PyType_Spec lzma_compressor_type_spec = {
934933
// lzma_compressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
935934
// which prevents to create a subclass.
936935
// So calling PyType_GetModuleState() in this file is always safe.
937-
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC),
936+
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE),
938937
.slots = lzma_compressor_type_slots,
939938
};
940939

@@ -1315,8 +1314,6 @@ _lzma_LZMADecompressor_impl(PyTypeObject *type, int format,
13151314
static void
13161315
Decompressor_dealloc(PyObject *op)
13171316
{
1318-
PyTypeObject *tp = Py_TYPE(op);
1319-
PyObject_GC_UnTrack(op);
13201317
Decompressor *self = Decompressor_CAST(op);
13211318
if(self->input_buffer != NULL)
13221319
PyMem_Free(self->input_buffer);
@@ -1326,6 +1323,7 @@ Decompressor_dealloc(PyObject *op)
13261323
if (self->lock != NULL) {
13271324
PyThread_free_lock(self->lock);
13281325
}
1326+
PyTypeObject *tp = Py_TYPE(self);
13291327
tp->tp_free(self);
13301328
Py_DECREF(tp);
13311329
}
@@ -1383,7 +1381,7 @@ static PyType_Spec lzma_decompressor_type_spec = {
13831381
// lzma_decompressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
13841382
// which prevents to create a subclass.
13851383
// So calling PyType_GetModuleState() in this file is always safe.
1386-
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC),
1384+
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE),
13871385
.slots = lzma_decompressor_type_slots,
13881386
};
13891387

0 commit comments

Comments
 (0)