summaryrefslogtreecommitdiff
path: root/dev-python/shiboken2/files/shiboken2-5.15.2-python311-fixups.patch
blob: 4ab4355555914bd04b72ca61cb2d629e2643390a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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<PyTypeObject *>(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<void *>(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<SbkObjectType *>(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<PyTypeObject *>(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<SbkEnumType *>(type);
     PepType_SETP(enumType)->cppName = cppName;