LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File lldb-fix-build-with-python-3.7.patch of Package llvm6 (Project home:bmwiedemann:reproducible:test)

From acbe5dc5cf0cf6852f02794987178595051a3a4e Mon Sep 17 00:00:00 2001
From: Michal Srb <msrb@suse.com>
Date: Wed, 25 Jul 2018 10:08:58 +0200
Subject: [PATCH] Fix build with python 3.7.

The PyUnicode_AsUTF8AndSize now returns const char*, so we can not cast
it to char*. However, the PyString_AsStringAndSize from python 2 still
needs char**.
---
 source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index 6a9d57d5a..3382813a5 100644
--- a/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -399,11 +399,11 @@ llvm::StringRef PythonString::GetString() const {
     return llvm::StringRef();
 
   Py_ssize_t size;
-  char *c;
 
 #if PY_MAJOR_VERSION >= 3
-  c = PyUnicode_AsUTF8AndSize(m_py_obj, &size);
+  const char *c = PyUnicode_AsUTF8AndSize(m_py_obj, &size);
 #else
+  char *c;
   PyString_AsStringAndSize(m_py_obj, &c, &size);
 #endif
   return llvm::StringRef(c, size);
-- 
2.16.4