From 009bc0f4bee5a39e08aaae6ef31c17e30f58bf91 Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Sat, 11 Sep 2021 15:51:02 +0200 Subject: Shiboken: Change type(SbkType_FromSpec) to PyType_Object This step prepares the transition of type generation to PyPy compatibility. [ChangeLog][shiboken6] SbkType_FromSpec() has been changed to return a PyType_Object *. Task-number: PYSIDE-535 Change-Id: I74e2e527e66a41f1a9f3f911f44d641139371889 Reviewed-by: Friedemann Kleint --- sources/pyside6/PySide6/QtQml/pysideqmlregistertype.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'sources/pyside6/PySide6/QtQml/pysideqmlregistertype.cpp') diff --git a/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.cpp b/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.cpp index 82824c77a..aa89579be 100644 --- a/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.cpp +++ b/sources/pyside6/PySide6/QtQml/pysideqmlregistertype.cpp @@ -405,12 +405,8 @@ static PyType_Spec PropertyListType_spec = { PyTypeObject *PropertyListTypeF(void) { - static PyTypeObject *type = nullptr; - if (!type) { - PyObject *bases = Py_BuildValue("(O)", PySidePropertyTypeF()); - type = (PyTypeObject *)SbkType_FromSpecWithBases(&PropertyListType_spec, bases); - Py_XDECREF(bases); - } + static Shiboken::AutoDecRef bases(Py_BuildValue("(O)", PySidePropertyTypeF())); + static auto *type = SbkType_FromSpecWithBases(&PropertyListType_spec, bases); return type; } @@ -674,8 +670,7 @@ static PyType_Spec QtQml_VolatileBoolType_spec = { PyTypeObject *QtQml_VolatileBoolTypeF(void) { - static PyTypeObject *type = reinterpret_cast( - SbkType_FromSpec(&QtQml_VolatileBoolType_spec)); + static auto *type = SbkType_FromSpec(&QtQml_VolatileBoolType_spec); return type; } -- cgit v1.2.3