From 08045120500d958fa55f7bf1045159e8c6ce8e56 Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Sun, 11 Sep 2022 11:19:20 +0200 Subject: [PATCH] Fix Property GC tracking for Python 3.11 The GC was not untracked when PySide Property was deleted. This was found by the new deeper error tracking in debug Python 3.11 . Fixes: PYSIDE-1960 Change-Id: I5ecdfb88529c22a44575ca9460d6753b1e389079 Pick-to: 6.2 6.3 5.15 Reviewed-by: Friedemann Kleint (cherry picked from commit ace680f4c5fc8564df9daaa41bf8779c9fffa671) Gbp-Pq: Name Fix-Property-GC-tracking-for-Python-3.11.patch --- sources/pyside2/libpyside/pysideproperty.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp index 1a3a411..86909d3 100644 --- a/sources/pyside2/libpyside/pysideproperty.cpp +++ b/sources/pyside2/libpyside/pysideproperty.cpp @@ -104,6 +104,7 @@ static PyType_Slot PySidePropertyType_slots[] = { {Py_tp_init, (void *)qpropertyTpInit}, {Py_tp_new, (void *)qpropertyTpNew}, {Py_tp_getset, PySidePropertyType_getset}, + {Py_tp_del, reinterpret_cast(PyObject_GC_Del)}, {0, 0} }; // Dotted modulename is crucial for SbkType_FromSpec to work. Is this name right? @@ -249,6 +250,7 @@ static void qpropertyDeAlloc(PyObject *self) // This was not needed before Python 3.8 (Python issue 35810) Py_DECREF(Py_TYPE(self)); } + PyObject_GC_UnTrack(self); Py_TYPE(self)->tp_free(self); } -- 2.30.2