Add patch to fix build with Python 3.7

This commit is contained in:
Jonathan Wakely 2018-06-19 18:15:55 +01:00
parent 139c6b50e6
commit c6c9a85f21
2 changed files with 46 additions and 0 deletions

View File

@ -0,0 +1,39 @@
From 660487c43fde76f3e64f1cb2e644500da92fe582 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= <bero@lindev.ch>
Date: Fri, 9 Feb 2018 18:20:30 +0100
Subject: [PATCH] Fix build with Python 3.7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Python 3.7 changes the return type of _PyUnicode_AsString()
from void* to const char* -- causing the build of boost-python
to fail.
Signed-off-by: Bernhard Rosenkränzer <bero@lindev.ch>
---
src/converter/builtin_converters.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/converter/builtin_converters.cpp b/src/converter/builtin_converters.cpp
index 1c28af7fc..ee2d5b479 100644
--- a/libs/python/src/converter/builtin_converters.cpp
+++ b/libs/python/src/converter/builtin_converters.cpp
@@ -45,11 +45,16 @@ namespace
{
return PyString_Check(obj) ? PyString_AsString(obj) : 0;
}
-#else
+#elif PY_VERSION_HEX < 0x03070000
void* convert_to_cstring(PyObject* obj)
{
return PyUnicode_Check(obj) ? _PyUnicode_AsString(obj) : 0;
}
+#else
+ void* convert_to_cstring(PyObject* obj)
+ {
+ return PyUnicode_Check(obj) ? const_cast<void*>(reinterpret_cast<const void*>(_PyUnicode_AsString(obj))) : 0;
+ }
#endif
// Given a target type and a SlotPolicy describing how to perform a

View File

@ -143,6 +143,9 @@ Patch84: boost-1.66.0-spirit-abs-overflow.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=1585515
Patch85: boost-1.66.0-compute.patch
# https://github.com/boostorg/python/pull/186
Patch86: boost-1.66.0-python37.patch
%bcond_with tests
%bcond_with docs_generated
@ -756,6 +759,7 @@ find ./boost -name '*.hpp' -perm /111 | xargs chmod a-x
%patch83 -p1
%patch84 -p1
%patch85 -p2
%patch86 -p1
%build
# Dump the versions being used into the build logs.
@ -1474,6 +1478,9 @@ fi
%{_mandir}/man1/bjam.1*
%changelog
* Tue Jun 19 2018 Jonathan Wakely <jwakely@redhat.com> - 1.66.0-11
- Add patch to fix build with Python 3.7
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 1.66.0-11
- Rebuilt for Python 3.7