]> git.proxmox.com Git - ceph.git/blob - patches/0017-python3.10-pep-620.patch
update ceph source to reef 18.1.2
[ceph.git] / patches / 0017-python3.10-pep-620.patch
1 Description: Fix Python 3.10 (PEP-620) incompatibility
2 Origin: upstream, https://github.com/boostorg/python/commit/500194edb7833d0627ce7a2595fec49d0aae2484
3 Author: Stefan Seefeld <stefan@seefeld.name>
4 Last-Update: 2020-11-13
5
6 --- a/src/boost/boost/python/detail/wrap_python.hpp
7 +++ b/src/boost/boost/python/detail/wrap_python.hpp
8 @@ -227,7 +227,11 @@
9
10 # define PyVarObject_HEAD_INIT(type, size) \
11 PyObject_HEAD_INIT(type) size,
12 +#endif
13
14 +#if PY_VERSION_HEX < 0x030900A4
15 +# define Py_SET_TYPE(obj, type) ((Py_TYPE(obj) = (type)), (void)0)
16 +# define Py_SET_SIZE(obj, size) ((Py_SIZE(obj) = (size)), (void)0)
17 #endif
18
19
20 --- a/src/boost/boost/python/object/make_instance.hpp
21 +++ b/src/boost/boost/python/object/make_instance.hpp
22 @@ -47,7 +47,7 @@
23
24 // Note the position of the internally-stored Holder,
25 // for the sake of destruction
26 - Py_SIZE(instance) = offsetof(instance_t, storage);
27 + Py_SET_SIZE(instance, offsetof(instance_t, storage));
28
29 // Release ownership of the python object
30 protect.cancel();
31 --- a/src/boost/libs/python/src/object/class.cpp
32 +++ b/src/boost/libs/python/src/object/class.cpp
33 @@ -208,7 +208,7 @@
34 {
35 if (static_data_object.tp_dict == 0)
36 {
37 - Py_TYPE(&static_data_object) = &PyType_Type;
38 + Py_SET_TYPE(&static_data_object, &PyType_Type);
39 static_data_object.tp_base = &PyProperty_Type;
40 if (PyType_Ready(&static_data_object))
41 return 0;
42 @@ -316,7 +316,7 @@
43 {
44 if (class_metatype_object.tp_dict == 0)
45 {
46 - Py_TYPE(&class_metatype_object) = &PyType_Type;
47 + Py_SET_TYPE(&class_metatype_object, &PyType_Type);
48 class_metatype_object.tp_base = &PyType_Type;
49 if (PyType_Ready(&class_metatype_object))
50 return type_handle();
51 @@ -374,12 +374,7 @@
52 // like, so we'll store the total size of the object
53 // there. A negative number indicates that the extra
54 // instance memory is not yet allocated to any holders.
55 -#if PY_VERSION_HEX >= 0x02060000
56 - Py_SIZE(result) =
57 -#else
58 - result->ob_size =
59 -#endif
60 - -(static_cast<int>(offsetof(instance<>,storage) + instance_size));
61 + Py_SET_SIZE(result,-static_cast<int>(offsetof(instance<>,storage) + instance_size));
62 }
63 return (PyObject*)result;
64 }
65 @@ -470,7 +465,7 @@
66 {
67 if (class_type_object.tp_dict == 0)
68 {
69 - Py_TYPE(&class_type_object) = incref(class_metatype().get());
70 + Py_SET_TYPE(&class_type_object, incref(class_metatype().get()));
71 class_type_object.tp_base = &PyBaseObject_Type;
72 if (PyType_Ready(&class_type_object))
73 return type_handle();
74 @@ -739,7 +734,7 @@
75 assert(holder_offset >= offsetof(objects::instance<>,storage));
76
77 // Record the fact that the storage is occupied, noting where it starts
78 - Py_SIZE(self) = holder_offset;
79 + Py_SET_SIZE(self, holder_offset);
80 return (char*)self + holder_offset;
81 }
82 else
83 --- a/src/boost/libs/python/src/object/enum.cpp
84 +++ b/src/boost/libs/python/src/object/enum.cpp
85 @@ -153,7 +153,7 @@
86 {
87 if (enum_type_object.tp_dict == 0)
88 {
89 - Py_TYPE(&enum_type_object) = incref(&PyType_Type);
90 + Py_SET_TYPE(&enum_type_object, incref(&PyType_Type));
91 #if PY_VERSION_HEX >= 0x03000000
92 enum_type_object.tp_base = &PyLong_Type;
93 #else
94 --- a/src/boost/libs/python/src/object/function.cpp
95 +++ b/src/boost/libs/python/src/object/function.cpp
96 @@ -107,7 +107,7 @@
97 PyObject* p = this;
98 if (Py_TYPE(&function_type) == 0)
99 {
100 - Py_TYPE(&function_type) = &PyType_Type;
101 + Py_SET_TYPE(&function_type, &PyType_Type);
102 ::PyType_Ready(&function_type);
103 }
104
105 --- a/src/boost/libs/python/src/object/life_support.cpp
106 +++ b/src/boost/libs/python/src/object/life_support.cpp
107 @@ -93,7 +93,7 @@
108
109 if (Py_TYPE(&life_support_type) == 0)
110 {
111 - Py_TYPE(&life_support_type) = &PyType_Type;
112 + Py_SET_TYPE(&life_support_type, &PyType_Type);
113 PyType_Ready(&life_support_type);
114 }
115
116