File: Fix-Property-GC-tracking-for-Python-3.11.patch

package info (click to toggle)
pyside2 5.15.8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 34,708 kB
  • sloc: python: 223,764; cpp: 80,118; xml: 17,240; sh: 68; makefile: 39; javascript: 16
file content (36 lines) | stat: -rw-r--r-- 1,428 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From: Christian Tismer <tismer@stackless.com>
Date: Sun, 11 Sep 2022 11:19:20 +0200
Subject: 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 <Friedemann.Kleint@qt.io>
(cherry picked from commit ace680f4c5fc8564df9daaa41bf8779c9fffa671)
---
 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 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<void *>(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);
 }