From 15fe017be6eb8b3aaf32d06eb21c61bd7eb3907e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 12 Jan 2024 12:11:20 +0100 Subject: Use PyType_GetSlot() instead of accessing PyTypeObject's slots in library code Using PepType_GetSlot() as is requires adding ugly casts. To work around, add a new file with convenience helper functions in C++ linkage. This also allows for using templates for tp_alloc. Task-number: PYSIDE-560 Change-Id: Ia50a226f5b545861f885d600445b91b4e11713c5 Reviewed-by: Christian Tismer --- sources/pyside6/libpyside/dynamicqmetaobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sources/pyside6/libpyside/dynamicqmetaobject.cpp') 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)) { -- cgit v1.2.3