From 441ffbd4fc622e67acd81e9c1c6d3a0b0fbcacf0 Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Tue, 14 Feb 2023 14:46:22 +0100 Subject: Support running PySide on Python 3.12 Builtin types no longer have tp_dict set. We need to use PyType_GetDict, instead. This works without Limited API at the moment. With some great cheating, this works with Limited API, too. We emulate PyType_GetDict by tp_dict if that is not 0. Otherwise we create an empty dict. Some small changes to Exception handling and longer warm-up in leaking tests were found, too. Pick-to: 6.6 6.5 6.2 Task-number: PYSIDE-2230 Change-Id: I8a56de6208ec00979255b39b5784dfc9b4b92def Reviewed-by: Friedemann Kleint --- sources/pyside6/libpyside/pysideproperty.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sources/pyside6/libpyside/pysideproperty.cpp') diff --git a/sources/pyside6/libpyside/pysideproperty.cpp b/sources/pyside6/libpyside/pysideproperty.cpp index 2658b5f03..d68185667 100644 --- a/sources/pyside6/libpyside/pysideproperty.cpp +++ b/sources/pyside6/libpyside/pysideproperty.cpp @@ -443,8 +443,8 @@ static int qpropertyClear(PyObject *self) static PyObject *getFromType(PyTypeObject *type, PyObject *name) { - PyObject *attr = nullptr; - attr = PyDict_GetItem(type->tp_dict, name); + AutoDecRef tpDict(PepType_GetDict(type)); + auto *attr = PyDict_GetItem(tpDict.object(), name); if (!attr) { PyObject *bases = type->tp_bases; const Py_ssize_t size = PyTuple_GET_SIZE(bases); -- cgit v1.2.3