diff --git a/srcpkgs/shiboken2/patches/python-3.11.patch b/srcpkgs/shiboken2/patches/python-3.11.patch new file mode 100644 index 00000000000..2520f17a0c5 --- /dev/null +++ b/srcpkgs/shiboken2/patches/python-3.11.patch @@ -0,0 +1,56 @@ +--- a/sources/shiboken2/libshiboken/basewrapper.cpp ++++ b/sources/shiboken2/libshiboken/basewrapper.cpp +@@ -64,6 +64,12 @@ + #include + #endif + ++#if PY_VERSION_HEX < 0x03090000 ++void Py_SET_TYPE(PyObject *o, PyTypeObject *type) { ++ Py_TYPE(o) = type; ++} ++#endif ++ + namespace { + void _destroyParentInfo(SbkObject *obj, bool keepReference); + } +@@ -377,7 +383,7 @@ SbkObjectType *SbkObject_TypeF(void) + static PyTypeObject *type = nullptr; + if (!type) { + type = reinterpret_cast(SbkType_FromSpec(&SbkObject_Type_spec)); +- Py_TYPE(type) = SbkObjectType_TypeF(); ++ Py_SET_TYPE(type, SbkObjectType_TypeF()); + Py_INCREF(Py_TYPE(type)); + type->tp_weaklistoffset = offsetof(SbkObject, weakreflist); + type->tp_dictoffset = offsetof(SbkObject, ob_dict); +@@ -1152,7 +1158,7 @@ introduceWrapperType(PyObject *enclosing + typeSpec->slots[0].pfunc = reinterpret_cast(baseType ? baseType : SbkObject_TypeF()); + + PyObject *heaptype = SbkType_FromSpecWithBases(typeSpec, baseTypes); +- Py_TYPE(heaptype) = SbkObjectType_TypeF(); ++ Py_SET_TYPE(heaptype, SbkObjectType_TypeF()); + Py_INCREF(Py_TYPE(heaptype)); + auto *type = reinterpret_cast(heaptype); + #if PY_VERSION_HEX < 0x03000000 +--- a/sources/shiboken2/libshiboken/sbkenum.cpp ++++ b/sources/shiboken2/libshiboken/sbkenum.cpp +@@ -55,6 +55,11 @@ + #define SbkEnumType_Check(o) (Py_TYPE(Py_TYPE(o)) == SbkEnumType_TypeF()) + typedef PyObject *(*enum_func)(PyObject *, PyObject *); + ++#if PY_VERSION_HEX < 0x03090000 ++void Py_SET_TYPE(PyObject *o, PyTypeObject *type) { ++ Py_TYPE(o) = type; ++} ++#endif + extern "C" + { + +@@ -753,7 +758,7 @@ newTypeWithName(const char *name, + PyTuple_SetItem(bases, 0, reinterpret_cast(basetype)); + auto *type = reinterpret_cast(SbkType_FromSpecWithBases(&newspec, bases)); + PyErr_Print(); +- Py_TYPE(type) = SbkEnumType_TypeF(); ++ Py_SET_TYPE(type, SbkEnumType_TypeF()); + + auto *enumType = reinterpret_cast(type); + PepType_SETP(enumType)->cppName = cppName;