diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-08-28 12:10:27 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2025-09-03 10:46:27 +0200 |
| commit | e068fe929a7e90a3c5c7844b14fbe15891349c10 (patch) | |
| tree | 9ff47c65d7d75e0d8cd708c82f7fa0ff9cd1d788 /sources/pyside6/libpysideqml | |
| parent | 6a657da8f490e65368550f39f0cd7042db228bac (diff) | |
Fix compilation with Python 3.14/raised limited API/PyObject parameters
Some macros (Py_INCREF/Py_TYPE) were reimplemented as functions,
unearthing some type incompatibilities.
Pick-to: 6.9 6.8
Task-number: PYSIDE-3147
Change-Id: If10bc5941d718d8845c7bbd5facf6021539aad34
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/pyside6/libpysideqml')
6 files changed, 29 insertions, 23 deletions
diff --git a/sources/pyside6/libpysideqml/pysideqmlattached.cpp b/sources/pyside6/libpysideqml/pysideqmlattached.cpp index 41d7dee97..4b6666d8a 100644 --- a/sources/pyside6/libpysideqml/pysideqmlattached.cpp +++ b/sources/pyside6/libpysideqml/pysideqmlattached.cpp @@ -166,12 +166,13 @@ void initQmlAttached(PyObject *module) std::fill(attachingTypes, attachingTypes + MAX_ATTACHING_TYPES, nullptr); AttachedFactoryInitializer<MAX_ATTACHING_TYPES - 1>::init(); - if (InitSignatureStrings(PySideQmlAttached_TypeF(), qmlAttached_SignatureStrings) < 0) + auto *qmlAttachedType = PySideQmlAttached_TypeF(); + if (InitSignatureStrings(qmlAttachedType, qmlAttached_SignatureStrings) < 0) return; - Py_INCREF(PySideQmlAttached_TypeF()); - PyModule_AddObject(module, "QmlAttached", - reinterpret_cast<PyObject *>(PySideQmlAttached_TypeF())); + auto *obQmlAttachedType = reinterpret_cast<PyObject *>(qmlAttachedType); + Py_INCREF(obQmlAttachedType); + PyModule_AddObject(module, "QmlAttached", obQmlAttachedType); } PySide::Qml::QmlExtensionInfo qmlAttachedInfo(PyTypeObject *t, diff --git a/sources/pyside6/libpysideqml/pysideqmlextended.cpp b/sources/pyside6/libpysideqml/pysideqmlextended.cpp index e2a96b60c..6d49bdc54 100644 --- a/sources/pyside6/libpysideqml/pysideqmlextended.cpp +++ b/sources/pyside6/libpysideqml/pysideqmlextended.cpp @@ -121,12 +121,13 @@ static QObject *extensionFactory(QObject *o) void initQmlExtended(PyObject *module) { - if (InitSignatureStrings(PySideQmlExtended_TypeF(), qmlExtended_SignatureStrings) < 0) + auto *qmlExtendedType = PySideQmlExtended_TypeF(); + if (InitSignatureStrings(qmlExtendedType, qmlExtended_SignatureStrings) < 0) return; - Py_INCREF(PySideQmlExtended_TypeF()); - PyModule_AddObject(module, "QmlExtended", - reinterpret_cast<PyObject *>(PySideQmlExtended_TypeF())); + auto *obQmlExtendedType = reinterpret_cast<PyObject *>(qmlExtendedType); + Py_INCREF(obQmlExtendedType); + PyModule_AddObject(module, "QmlExtended", obQmlExtendedType); } PySide::Qml::QmlExtensionInfo qmlExtendedInfo(PyObject *t, diff --git a/sources/pyside6/libpysideqml/pysideqmlforeign.cpp b/sources/pyside6/libpysideqml/pysideqmlforeign.cpp index ef8d7fdf0..7ac798030 100644 --- a/sources/pyside6/libpysideqml/pysideqmlforeign.cpp +++ b/sources/pyside6/libpysideqml/pysideqmlforeign.cpp @@ -83,12 +83,13 @@ namespace PySide::Qml { void initQmlForeign(PyObject *module) { - if (InitSignatureStrings(PySideQmlForeign_TypeF(), qmlForeign_SignatureStrings) < 0) + auto *foreignType = PySideQmlForeign_TypeF(); + if (InitSignatureStrings(foreignType, qmlForeign_SignatureStrings) < 0) return; - Py_INCREF(PySideQmlForeign_TypeF()); - PyModule_AddObject(module, "QmlForeign", - reinterpret_cast<PyObject *>(PySideQmlForeign_TypeF())); + auto *obForeignType = reinterpret_cast<PyObject *>(foreignType); + Py_INCREF(obForeignType); + PyModule_AddObject(module, "QmlForeign", obForeignType); } } // namespace PySide::Qml diff --git a/sources/pyside6/libpysideqml/pysideqmllistproperty.cpp b/sources/pyside6/libpysideqml/pysideqmllistproperty.cpp index 5011fd613..adad4cb99 100644 --- a/sources/pyside6/libpysideqml/pysideqmllistproperty.cpp +++ b/sources/pyside6/libpysideqml/pysideqmllistproperty.cpp @@ -306,9 +306,10 @@ void initQtQmlListProperty(PyObject *module) // Register QQmlListProperty metatype for use in QML qRegisterMetaType<QQmlListProperty<QObject>>(); - Py_INCREF(reinterpret_cast<PyObject *>(PropertyList_TypeF())); - PyModule_AddObject(module, PepType_GetNameStr(PropertyList_TypeF()), - reinterpret_cast<PyObject *>(PropertyList_TypeF())); + auto *propertyListType = PropertyList_TypeF(); + auto *obPropertyListType = reinterpret_cast<PyObject *>(propertyListType); + Py_INCREF(obPropertyListType); + PyModule_AddObject(module, PepType_GetNameStr(propertyListType), obPropertyListType); } } // namespace PySide::Qml diff --git a/sources/pyside6/libpysideqml/pysideqmlnamedelement.cpp b/sources/pyside6/libpysideqml/pysideqmlnamedelement.cpp index a0c05b384..0b3f7358a 100644 --- a/sources/pyside6/libpysideqml/pysideqmlnamedelement.cpp +++ b/sources/pyside6/libpysideqml/pysideqmlnamedelement.cpp @@ -65,10 +65,11 @@ static const char *qmlNamedElement_SignatureStrings[] = { void initQmlNamedElement(PyObject *module) { - if (InitSignatureStrings(PySideQmlNamedElement_TypeF(), qmlNamedElement_SignatureStrings) < 0) + auto *qmlNamedElementType = PySideQmlNamedElement_TypeF(); + if (InitSignatureStrings(qmlNamedElementType, qmlNamedElement_SignatureStrings) < 0) return; - Py_INCREF(PySideQmlNamedElement_TypeF()); - PyModule_AddObject(module, "QmlNamedElement", - reinterpret_cast<PyObject *>(PySideQmlNamedElement_TypeF())); + auto *obQmlNamedElementType = reinterpret_cast<PyObject *>(qmlNamedElementType); + Py_INCREF(obQmlNamedElementType); + PyModule_AddObject(module, "QmlNamedElement", obQmlNamedElementType); } diff --git a/sources/pyside6/libpysideqml/pysideqmluncreatable.cpp b/sources/pyside6/libpysideqml/pysideqmluncreatable.cpp index 348d53d58..b83fa88f5 100644 --- a/sources/pyside6/libpysideqml/pysideqmluncreatable.cpp +++ b/sources/pyside6/libpysideqml/pysideqmluncreatable.cpp @@ -96,12 +96,13 @@ static const char *qmlUncreatable_SignatureStrings[] = { void initQmlUncreatable(PyObject *module) { - if (InitSignatureStrings(PySideQmlUncreatable_TypeF(), qmlUncreatable_SignatureStrings) < 0) + auto *qmlUncreatableType = PySideQmlUncreatable_TypeF(); + if (InitSignatureStrings(qmlUncreatableType, qmlUncreatable_SignatureStrings) < 0) return; - Py_INCREF(PySideQmlUncreatable_TypeF()); - PyModule_AddObject(module, "QmlUncreatable", - reinterpret_cast<PyObject *>(PySideQmlUncreatable_TypeF())); + auto *obQmlUncreatableType = reinterpret_cast<PyObject *>(qmlUncreatableType); + Py_INCREF(obQmlUncreatableType); + PyModule_AddObject(module, "QmlUncreatable", obQmlUncreatableType); } void setUncreatableClassInfo(PyTypeObject *type, const QByteArray &reason) |
