mirror of
https://git.proxmox.com/git/ceph.git
synced 2025-04-28 16:34:15 +00:00
backport compat fix for python 3.10+ PEP 620
cherry-picked from Debian boost 1.74 package [0], adapted to the
bundled 1.75 boost included by ceph. Note that 1.75 has the fopen
compat patch already included.
[0]: 107cd01182
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
69b3aae329
commit
5ff1242a9b
116
patches/0017-python3.10-pep-620.patch
Normal file
116
patches/0017-python3.10-pep-620.patch
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
Description: Fix Python 3.10 (PEP-620) incompatibility
|
||||||
|
Origin: upstream, https://github.com/boostorg/python/commit/500194edb7833d0627ce7a2595fec49d0aae2484
|
||||||
|
Author: Stefan Seefeld <stefan@seefeld.name>
|
||||||
|
Last-Update: 2020-11-13
|
||||||
|
|
||||||
|
--- a/src/boost/boost/python/detail/wrap_python.hpp
|
||||||
|
+++ b/src/boost/boost/python/detail/wrap_python.hpp
|
||||||
|
@@ -227,7 +227,11 @@
|
||||||
|
|
||||||
|
# define PyVarObject_HEAD_INIT(type, size) \
|
||||||
|
PyObject_HEAD_INIT(type) size,
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
+#if PY_VERSION_HEX < 0x030900A4
|
||||||
|
+# define Py_SET_TYPE(obj, type) ((Py_TYPE(obj) = (type)), (void)0)
|
||||||
|
+# define Py_SET_SIZE(obj, size) ((Py_SIZE(obj) = (size)), (void)0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
--- a/src/boost/boost/python/object/make_instance.hpp
|
||||||
|
+++ b/src/boost/boost/python/object/make_instance.hpp
|
||||||
|
@@ -47,7 +47,7 @@
|
||||||
|
|
||||||
|
// Note the position of the internally-stored Holder,
|
||||||
|
// for the sake of destruction
|
||||||
|
- Py_SIZE(instance) = offsetof(instance_t, storage);
|
||||||
|
+ Py_SET_SIZE(instance, offsetof(instance_t, storage));
|
||||||
|
|
||||||
|
// Release ownership of the python object
|
||||||
|
protect.cancel();
|
||||||
|
--- a/src/boost/libs/python/src/object/class.cpp
|
||||||
|
+++ b/src/boost/libs/python/src/object/class.cpp
|
||||||
|
@@ -208,7 +208,7 @@
|
||||||
|
{
|
||||||
|
if (static_data_object.tp_dict == 0)
|
||||||
|
{
|
||||||
|
- Py_TYPE(&static_data_object) = &PyType_Type;
|
||||||
|
+ Py_SET_TYPE(&static_data_object, &PyType_Type);
|
||||||
|
static_data_object.tp_base = &PyProperty_Type;
|
||||||
|
if (PyType_Ready(&static_data_object))
|
||||||
|
return 0;
|
||||||
|
@@ -316,7 +316,7 @@
|
||||||
|
{
|
||||||
|
if (class_metatype_object.tp_dict == 0)
|
||||||
|
{
|
||||||
|
- Py_TYPE(&class_metatype_object) = &PyType_Type;
|
||||||
|
+ Py_SET_TYPE(&class_metatype_object, &PyType_Type);
|
||||||
|
class_metatype_object.tp_base = &PyType_Type;
|
||||||
|
if (PyType_Ready(&class_metatype_object))
|
||||||
|
return type_handle();
|
||||||
|
@@ -374,12 +374,7 @@
|
||||||
|
// like, so we'll store the total size of the object
|
||||||
|
// there. A negative number indicates that the extra
|
||||||
|
// instance memory is not yet allocated to any holders.
|
||||||
|
-#if PY_VERSION_HEX >= 0x02060000
|
||||||
|
- Py_SIZE(result) =
|
||||||
|
-#else
|
||||||
|
- result->ob_size =
|
||||||
|
-#endif
|
||||||
|
- -(static_cast<int>(offsetof(instance<>,storage) + instance_size));
|
||||||
|
+ Py_SET_SIZE(result,-static_cast<int>(offsetof(instance<>,storage) + instance_size));
|
||||||
|
}
|
||||||
|
return (PyObject*)result;
|
||||||
|
}
|
||||||
|
@@ -470,7 +465,7 @@
|
||||||
|
{
|
||||||
|
if (class_type_object.tp_dict == 0)
|
||||||
|
{
|
||||||
|
- Py_TYPE(&class_type_object) = incref(class_metatype().get());
|
||||||
|
+ Py_SET_TYPE(&class_type_object, incref(class_metatype().get()));
|
||||||
|
class_type_object.tp_base = &PyBaseObject_Type;
|
||||||
|
if (PyType_Ready(&class_type_object))
|
||||||
|
return type_handle();
|
||||||
|
@@ -739,7 +734,7 @@
|
||||||
|
assert(holder_offset >= offsetof(objects::instance<>,storage));
|
||||||
|
|
||||||
|
// Record the fact that the storage is occupied, noting where it starts
|
||||||
|
- Py_SIZE(self) = holder_offset;
|
||||||
|
+ Py_SET_SIZE(self, holder_offset);
|
||||||
|
return (char*)self + holder_offset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
--- a/src/boost/libs/python/src/object/enum.cpp
|
||||||
|
+++ b/src/boost/libs/python/src/object/enum.cpp
|
||||||
|
@@ -153,7 +153,7 @@
|
||||||
|
{
|
||||||
|
if (enum_type_object.tp_dict == 0)
|
||||||
|
{
|
||||||
|
- Py_TYPE(&enum_type_object) = incref(&PyType_Type);
|
||||||
|
+ Py_SET_TYPE(&enum_type_object, incref(&PyType_Type));
|
||||||
|
#if PY_VERSION_HEX >= 0x03000000
|
||||||
|
enum_type_object.tp_base = &PyLong_Type;
|
||||||
|
#else
|
||||||
|
--- a/src/boost/libs/python/src/object/function.cpp
|
||||||
|
+++ b/src/boost/libs/python/src/object/function.cpp
|
||||||
|
@@ -107,7 +107,7 @@
|
||||||
|
PyObject* p = this;
|
||||||
|
if (Py_TYPE(&function_type) == 0)
|
||||||
|
{
|
||||||
|
- Py_TYPE(&function_type) = &PyType_Type;
|
||||||
|
+ Py_SET_TYPE(&function_type, &PyType_Type);
|
||||||
|
::PyType_Ready(&function_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
--- a/src/boost/libs/python/src/object/life_support.cpp
|
||||||
|
+++ b/src/boost/libs/python/src/object/life_support.cpp
|
||||||
|
@@ -93,7 +93,7 @@
|
||||||
|
|
||||||
|
if (Py_TYPE(&life_support_type) == 0)
|
||||||
|
{
|
||||||
|
- Py_TYPE(&life_support_type) = &PyType_Type;
|
||||||
|
+ Py_SET_TYPE(&life_support_type, &PyType_Type);
|
||||||
|
PyType_Ready(&life_support_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -10,3 +10,4 @@
|
|||||||
0014-fix-service-ordering-avoid-Before-remote-fs-pre.targ.patch
|
0014-fix-service-ordering-avoid-Before-remote-fs-pre.targ.patch
|
||||||
0015-d-control-drop-outdated-build-dependencies-and-bump-.patch
|
0015-d-control-drop-outdated-build-dependencies-and-bump-.patch
|
||||||
0016-d-rules-fix-no-restart-on-upgrade.patch
|
0016-d-rules-fix-no-restart-on-upgrade.patch
|
||||||
|
0017-python3.10-pep-620.patch
|
||||||
|
Loading…
Reference in New Issue
Block a user