The Fedora / upstream fixes (shiboken2-5.15.2-python311.patch) end up breaking Python 3.8 compatibility (maybe 3.9 too, but didn't get that far). Wrap them with PY_VERSION_HEX for Python 3.11. --- a/libshiboken/basewrapper.cpp +++ b/libshiboken/basewrapper.cpp @@ -366,7 +366,11 @@ SbkObjectType *SbkObject_TypeF(void) static PyTypeObject *type = nullptr; if (!type) { type = reinterpret_cast(SbkType_FromSpec(&SbkObject_Type_spec)); - Py_SET_TYPE(type, SbkObjectType_TypeF()); + #if PY_VERSION_HEX < 0x030B00A1 + Py_TYPE(type) = SbkObjectType_TypeF(); + #else + Py_SET_TYPE(type, SbkObjectType_TypeF()); + #endif Py_INCREF(Py_TYPE(type)); type->tp_weaklistoffset = offsetof(SbkObject, weakreflist); type->tp_dictoffset = offsetof(SbkObject, ob_dict); @@ -1110,7 +1114,11 @@ introduceWrapperType(PyObject *enclosingObject, typeSpec->slots[0].pfunc = reinterpret_cast(baseType ? baseType : SbkObject_TypeF()); PyObject *heaptype = SbkType_FromSpecWithBases(typeSpec, baseTypes); - Py_SET_TYPE(heaptype, SbkObjectType_TypeF()); + #if PY_VERSION_HEX < 0x030B00A1 + Py_TYPE(heaptype) = SbkObjectType_TypeF(); + #else + Py_SET_TYPE(heaptype, SbkObjectType_TypeF()); + #endif Py_INCREF(Py_TYPE(heaptype)); auto *type = reinterpret_cast(heaptype); #if PY_VERSION_HEX < 0x03000000 --- a/libshiboken/sbkenum.cpp +++ b/libshiboken/sbkenum.cpp @@ -741,7 +741,11 @@ newTypeWithName(const char *name, copyNumberMethods(numbers_fromFlag, newslots, &idx); newspec.slots = newslots; auto *type = reinterpret_cast(SbkType_FromSpec(&newspec)); - Py_SET_TYPE(type, SbkEnumType_TypeF()); + #if PY_VERSION_HEX < 0x030B00A1 + Py_TYPE(type) = SbkEnumType_TypeF(); + #else + Py_SET_TYPE(type, SbkEnumType_TypeF()); + #endif auto *enumType = reinterpret_cast(type); PepType_SETP(enumType)->cppName = cppName;