40 lines
1.3 KiB
Diff
40 lines
1.3 KiB
Diff
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
|