Fixes for Python 3.11 built in debug mode
Add missing PyObject_GC_UnTrack
for objects with Py_TPFLAGS_HAVE_GC
From https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_dealloc
If the type supports garbage collection (has the Py_TPFLAGS_HAVE_GC flag bit set), the destructor should call PyObject_GC_UnTrack() before clearing any member fields.
I can't fork this repository for create PR, need make this changes
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -1936,6 +1936,7 @@ static void cdataowninggc_dealloc(CDataObject *cd)
static void cdatafrombuf_dealloc(CDataObject *cd)
{
+ PyObject_GC_UnTrack(cd);
Py_buffer *view = ((CDataObject_frombuf *)cd)->bufferview;
cdata_dealloc(cd);
@@ -2040,6 +2041,7 @@ static void cdatagcp_finalize(CDataObject_gcp *cd)
static void cdatagcp_dealloc(CDataObject_gcp *cd)
{
+ PyObject_GC_UnTrack(cd);
PyObject *destructor = cd->destructor;
PyObject *origobj = cd->origobj;
cdata_dealloc((CDataObject *)cd);