summaryrefslogtreecommitdiffstats
path: root/lldb
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-07-25 11:35:28 +0000
committerPavel Labath <labath@google.com>2018-07-25 11:35:28 +0000
commit5457b426f5e15a29c0acc8af1a476132f8be2a36 (patch)
treef6aa4a1cdf727b06b365cc4733d64b7d7b8fb19d /lldb
parent84bd5db209687b7f0ef33fc58fa92ca9647351aa (diff)
downloadbcm5719-llvm-5457b426f5e15a29c0acc8af1a476132f8be2a36.tar.gz
bcm5719-llvm-5457b426f5e15a29c0acc8af1a476132f8be2a36.zip
Fix PythonString::GetString for >=python-3.7
The return value of PyUnicode_AsUTF8AndSize is now "const char *". Thanks to Brett Neumeier for testing the patch out on python 3.7. llvm-svn: 337908
Diffstat (limited to 'lldb')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index 6a9d57d5a30..90d8ab97fb7 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -399,14 +399,16 @@ llvm::StringRef PythonString::GetString() const {
return llvm::StringRef();
Py_ssize_t size;
- char *c;
+ const char *data;
#if PY_MAJOR_VERSION >= 3
- c = PyUnicode_AsUTF8AndSize(m_py_obj, &size);
+ data = PyUnicode_AsUTF8AndSize(m_py_obj, &size);
#else
+ char *c;
PyString_AsStringAndSize(m_py_obj, &c, &size);
+ data = c;
#endif
- return llvm::StringRef(c, size);
+ return llvm::StringRef(data, size);
}
size_t PythonString::GetSize() const {
OpenPOWER on IntegriCloud