diff options
Diffstat (limited to 'sources/pyside6/libpyside')
-rw-r--r-- | sources/pyside6/libpyside/class_property.cpp | 11 | ||||
-rw-r--r-- | sources/pyside6/libpyside/dynamicqmetaobject.cpp | 2 | ||||
-rw-r--r-- | sources/pyside6/libpyside/globalreceiverv2.cpp | 3 | ||||
-rw-r--r-- | sources/pyside6/libpyside/pysideclassdecorator_p.h | 5 | ||||
-rw-r--r-- | sources/pyside6/libpyside/pysideproperty.cpp | 5 | ||||
-rw-r--r-- | sources/pyside6/libpyside/pysidesignal.cpp | 17 |
6 files changed, 23 insertions, 20 deletions
diff --git a/sources/pyside6/libpyside/class_property.cpp b/sources/pyside6/libpyside/class_property.cpp index 99104445c..2bed97ef5 100644 --- a/sources/pyside6/libpyside/class_property.cpp +++ b/sources/pyside6/libpyside/class_property.cpp @@ -5,6 +5,7 @@ #include "pysidestaticstrings.h" #include "feature_select.h" +#include <pep384ext.h> #include <shiboken.h> #include <sbkstaticstrings.h> @@ -23,14 +24,14 @@ extern "C" { // `class_property.__get__()`: Always pass the class instead of the instance. static PyObject *PyClassProperty_descr_get(PyObject *self, PyObject * /*ob*/, PyObject *cls) { - return PyProperty_Type.tp_descr_get(self, cls, cls); + return PepExt_Type_GetDescrGetSlot(&PyProperty_Type)(self, cls, cls); } // `class_property.__set__()`: Just like the above `__get__()`. static int PyClassProperty_descr_set(PyObject *self, PyObject *obj, PyObject *value) { PyObject *cls = PyType_Check(obj) ? obj : reinterpret_cast<PyObject *>(Py_TYPE(obj)); - return PyProperty_Type.tp_descr_set(self, cls, value); + return PepExt_Type_GetDescrSetSlot(&PyProperty_Type)(self, cls, value); } // PYSIDE-2230: Why is this metaclass necessary? @@ -80,7 +81,7 @@ static int PyClassProperty_tp_init(PyObject *self, PyObject *args, PyObject *kwa { auto hold = Py_TYPE(self); self->ob_type = &PyProperty_Type; - auto ret = PyProperty_Type.tp_init(self, args, kwargs); + auto ret = PepExt_Type_GetInitSlot(&PyProperty_Type)(self, args, kwargs); self->ob_type = hold; return ret; } @@ -138,9 +139,9 @@ static int SbkObjectType_meta_setattro(PyObject *obj, PyObject *name, PyObject * && !PyObject_IsInstance(value, class_prop); if (call_descr_set) { // Call `class_property.__set__()` instead of replacing the `class_property`. - return Py_TYPE(descr)->tp_descr_set(descr, obj, value); + return PepExt_Type_GetDescrSetSlot(Py_TYPE(descr))(descr, obj, value); } // Replace existing attribute. - return PyType_Type.tp_setattro(obj, name, value); + return PepExt_Type_GetSetAttroSlot(&PyType_Type)(obj, name, value); } } // extern "C" diff --git a/sources/pyside6/libpyside/dynamicqmetaobject.cpp b/sources/pyside6/libpyside/dynamicqmetaobject.cpp index b41dbc275..048001f81 100644 --- a/sources/pyside6/libpyside/dynamicqmetaobject.cpp +++ b/sources/pyside6/libpyside/dynamicqmetaobject.cpp @@ -634,7 +634,7 @@ void MetaObjectBuilderPrivate::parsePythonType(PyTypeObject *type) const int index = m_baseObject->indexOfProperty(name); if (index == -1) addProperty(name, value); - } else if (Py_TYPE(value)->tp_call != nullptr) { + } else if (PepType_GetSlot(Py_TYPE(value), Py_tp_call) != nullptr) { // PYSIDE-198: PyFunction_Check does not work with Nuitka. // Register slots. if (PyObject_HasAttr(value, slotAttrName)) { diff --git a/sources/pyside6/libpyside/globalreceiverv2.cpp b/sources/pyside6/libpyside/globalreceiverv2.cpp index 09385645d..5fcf224ea 100644 --- a/sources/pyside6/libpyside/globalreceiverv2.cpp +++ b/sources/pyside6/libpyside/globalreceiverv2.cpp @@ -9,6 +9,7 @@ #include <autodecref.h> #include <gilstate.h> +#include <pep384ext.h> #include <QtCore/QMetaMethod> #include <QtCore/QSet> @@ -135,7 +136,7 @@ PyObject *DynamicSlotDataV2::callback() //create a callback based on method data if (m_isMethod) - callback = Py_TYPE(m_callback)->tp_descr_get(m_callback, m_pythonSelf, nullptr); + callback = PepExt_Type_CallDescrGet(m_callback, m_pythonSelf, nullptr); else Py_INCREF(callback); diff --git a/sources/pyside6/libpyside/pysideclassdecorator_p.h b/sources/pyside6/libpyside/pysideclassdecorator_p.h index d4e21a5b4..6068f6a2e 100644 --- a/sources/pyside6/libpyside/pysideclassdecorator_p.h +++ b/sources/pyside6/libpyside/pysideclassdecorator_p.h @@ -7,6 +7,7 @@ #include <pysidemacros.h> #include <sbkpython.h> +#include <pep384ext.h> #include <QtCore/QByteArray> @@ -119,7 +120,7 @@ struct Methods { static PyObject *tp_new(PyTypeObject *subtype) { - auto *result = reinterpret_cast<PySideClassDecorator *>(subtype->tp_alloc(subtype, 0)); + auto *result = PepExt_TypeCallAlloc<PySideClassDecorator>(subtype, 0); result->d = new DecoratorPrivate; return reinterpret_cast<PyObject *>(result); } @@ -129,7 +130,7 @@ struct Methods auto pySelf = reinterpret_cast<PyObject *>(self); auto decorator = reinterpret_cast<PySideClassDecorator *>(self); delete decorator->d; - Py_TYPE(pySelf)->tp_base->tp_free(self); + PepExt_TypeCallFree(Py_TYPE(pySelf)->tp_base, self); } static PyObject *tp_call(PyObject *self, PyObject *args, PyObject *kwds) diff --git a/sources/pyside6/libpyside/pysideproperty.cpp b/sources/pyside6/libpyside/pysideproperty.cpp index 2648ca43c..457415479 100644 --- a/sources/pyside6/libpyside/pysideproperty.cpp +++ b/sources/pyside6/libpyside/pysideproperty.cpp @@ -8,6 +8,7 @@ #include "pysidesignal_p.h" #include <shiboken.h> +#include <pep384ext.h> #include <signature.h> using namespace Shiboken; @@ -179,7 +180,7 @@ void PySidePropertyPrivate::metaCall(PyObject *source, QMetaObject::Call call, v static PyObject *qpropertyTpNew(PyTypeObject *subtype, PyObject * /* args */, PyObject * /* kwds */) { - auto *me = reinterpret_cast<PySideProperty *>(subtype->tp_alloc(subtype, 0)); + auto *me = PepExt_TypeCallAlloc<PySideProperty>(subtype, 0); me->d = new PySidePropertyPrivate; return reinterpret_cast<PyObject *>(me); } @@ -258,7 +259,7 @@ static void qpropertyDeAlloc(PyObject *self) Py_DECREF(Py_TYPE(self)); } PyObject_GC_UnTrack(self); - Py_TYPE(self)->tp_free(self); + PepExt_TypeCallFree(self); } // Create a copy of the property to prevent the @property.setter from modifying diff --git a/sources/pyside6/libpyside/pysidesignal.cpp b/sources/pyside6/libpyside/pysidesignal.cpp index 0c6a23245..150dd500e 100644 --- a/sources/pyside6/libpyside/pysidesignal.cpp +++ b/sources/pyside6/libpyside/pysidesignal.cpp @@ -18,6 +18,7 @@ #include <QtCore/QObject> #include <QtCore/QMetaMethod> #include <QtCore/QMetaObject> +#include <pep384ext.h> #include <signature.h> #include <algorithm> @@ -298,7 +299,7 @@ static void signalFree(void *vself) Py_XDECREF(self->homonymousMethod); self->homonymousMethod = nullptr; - Py_TYPE(pySelf)->tp_base->tp_free(self); + PepExt_TypeCallFree(Py_TYPE(pySelf)->tp_base, self); } static PyObject *signalGetItem(PyObject *obSelf, PyObject *key) @@ -368,7 +369,7 @@ static void signalInstanceFree(void *vself) self->d = nullptr; } self->deleted = true; - Py_TYPE(pySelf)->tp_base->tp_free(self); + PepExt_TypeCallFree(Py_TYPE(pySelf)->tp_base, self); } // PYSIDE-1523: PyFunction_Check is not accepting compiled functions and @@ -754,18 +755,16 @@ static PyObject *signalCall(PyObject *self, PyObject *args, PyObject *kw) return nullptr; } - descrgetfunc getDescriptor = Py_TYPE(signal->homonymousMethod)->tp_descr_get; - // Check if there exists a method with the same name as the signal, which is also a static // method in C++ land. - Shiboken::AutoDecRef homonymousMethod(getDescriptor(signal->homonymousMethod, - nullptr, nullptr)); + Shiboken::AutoDecRef homonymousMethod(PepExt_Type_CallDescrGet(signal->homonymousMethod, + nullptr, nullptr)); if (PyCFunction_Check(homonymousMethod.object()) && (PyCFunction_GET_FLAGS(homonymousMethod.object()) & METH_STATIC)) return PyObject_Call(homonymousMethod, args, kw); // Assumes homonymousMethod is not a static method. - ternaryfunc callFunc = Py_TYPE(signal->homonymousMethod)->tp_call; + ternaryfunc callFunc = PepExt_Type_GetCallSlot(Py_TYPE(signal->homonymousMethod)); return callFunc(homonymousMethod, args, kw); } @@ -822,8 +821,8 @@ static PyObject *signalInstanceCall(PyObject *self, PyObject *args, PyObject *kw return nullptr; } - descrgetfunc getDescriptor = Py_TYPE(hom)->tp_descr_get; - Shiboken::AutoDecRef homonymousMethod(getDescriptor(hom, PySideSignal->d->source, nullptr)); + Shiboken::AutoDecRef homonymousMethod(PepExt_Type_CallDescrGet(hom, PySideSignal->d->source, + nullptr)); return PyObject_Call(homonymousMethod, args, kw); } |