From: Christian Tismer Date: Sun, 11 Sep 2022 09:19:20 +0000 (+0200) Subject: Fix Property GC tracking for Python 3.11 X-Git-Tag: archive/raspbian/5.15.8-2+rpi1^2^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=113c16fe58824f58f91d275a8769051ca31aef7f;p=pyside2.git 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 --- diff --git a/sources/pyside2/libpyside/pysideproperty.cpp b/sources/pyside2/libpyside/pysideproperty.cpp index 3b4039a..5739c28 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); }