Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions Modules/_lzmamodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,12 +866,13 @@ Compressor_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
static void
Compressor_dealloc(PyObject *op)
{
PyTypeObject *tp = Py_TYPE(op);
PyObject_GC_UnTrack(op);
Compressor *self = Compressor_CAST(op);
lzma_end(&self->lzs);
if (self->lock != NULL) {
PyThread_free_lock(self->lock);
}
PyTypeObject *tp = Py_TYPE(self);
tp->tp_free(self);
Py_DECREF(tp);
}
Expand Down Expand Up @@ -933,7 +934,7 @@ static PyType_Spec lzma_compressor_type_spec = {
// lzma_compressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
// which prevents to create a subclass.
// So calling PyType_GetModuleState() in this file is always safe.
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE),
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC),
.slots = lzma_compressor_type_slots,
};

Expand Down Expand Up @@ -1314,6 +1315,8 @@ _lzma_LZMADecompressor_impl(PyTypeObject *type, int format,
static void
Decompressor_dealloc(PyObject *op)
{
PyTypeObject *tp = Py_TYPE(op);
PyObject_GC_UnTrack(op);
Decompressor *self = Decompressor_CAST(op);
if(self->input_buffer != NULL)
PyMem_Free(self->input_buffer);
Expand All @@ -1323,7 +1326,6 @@ Decompressor_dealloc(PyObject *op)
if (self->lock != NULL) {
PyThread_free_lock(self->lock);
}
PyTypeObject *tp = Py_TYPE(self);
tp->tp_free(self);
Py_DECREF(tp);
}
Expand Down Expand Up @@ -1381,7 +1383,7 @@ static PyType_Spec lzma_decompressor_type_spec = {
// lzma_decompressor_type_spec does not have Py_TPFLAGS_BASETYPE flag
// which prevents to create a subclass.
// So calling PyType_GetModuleState() in this file is always safe.
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE),
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_HAVE_GC),
.slots = lzma_decompressor_type_slots,
};

Expand Down
Loading