Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2023-02-14 14:46:22 +0100
committerChristian Tismer <tismer@stackless.com>2023-10-09 08:54:27 +0200
commit441ffbd4fc622e67acd81e9c1c6d3a0b0fbcacf0 (patch)
tree83226e3bccf205f6a941c53ce3698c88f99b7935 /sources/pyside6/libpyside/pysidesignal.cpp
parent92a4a2a0ed7a8a391406030d1db813de7dd31429 (diff)
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 <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6/libpyside/pysidesignal.cpp')
-rw-r--r--sources/pyside6/libpyside/pysidesignal.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/sources/pyside6/libpyside/pysidesignal.cpp b/sources/pyside6/libpyside/pysidesignal.cpp
index 7fb07fc38..64eb62b76 100644
--- a/sources/pyside6/libpyside/pysidesignal.cpp
+++ b/sources/pyside6/libpyside/pysidesignal.cpp
@@ -784,7 +784,8 @@ static PyObject *_getHomonymousMethod(PySideSignalInstance *inst)
for (Py_ssize_t idx = 0; idx < n; idx++) {
auto *sub_type = reinterpret_cast<PyTypeObject *>(PyTuple_GET_ITEM(mro, idx));
- auto *hom = PyDict_GetItem(sub_type->tp_dict, name);
+ AutoDecRef tpDict(PepType_GetDict(sub_type));
+ auto *hom = PyDict_GetItem(tpDict, name);
PyObject *realFunc{};
if (hom && PyCallable_Check(hom) && (realFunc = _getRealCallable(hom)))
return realFunc;
@@ -891,8 +892,8 @@ void updateSourceObject(PyObject *source)
Py_ssize_t pos = 0;
PyObject *key, *value;
auto *type = reinterpret_cast<PyTypeObject *>(mroItem.object());
-
- while (PyDict_Next(type->tp_dict, &pos, &key, &value)) {
+ AutoDecRef tpDict(PepType_GetDict(type));
+ while (PyDict_Next(tpDict, &pos, &key, &value)) {
if (PyObject_TypeCheck(value, PySideSignal_TypeF())) {
// PYSIDE-1751: We only insert an instance into the instance dict, if a signal
// of the same name is in the mro. This is the equivalent action