[Lldb-commits] [lldb] 75012a8 - [lldb] Use PyUnicode_GetLength instead of PyUnicode_GetSize
Tatyana Krasnukha via lldb-commits
lldb-commits at lists.llvm.org
Wed Aug 5 02:11:28 PDT 2020
Author: Tatyana Krasnukha
Date: 2020-08-05T11:59:47+03:00
New Revision: 75012a80440f2302d3dc0e57ea264b9c26c26789
URL: https://github.com/llvm/llvm-project/commit/75012a80440f2302d3dc0e57ea264b9c26c26789
DIFF: https://github.com/llvm/llvm-project/commit/75012a80440f2302d3dc0e57ea264b9c26c26789.diff
LOG: [lldb] Use PyUnicode_GetLength instead of PyUnicode_GetSize
PyUnicode_GetSize is deprecated since Python version 3.3.
Added:
Modified:
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
Removed:
################################################################################
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index 6f040fdef09b..7c49502f1b57 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -451,7 +451,11 @@ Expected<llvm::StringRef> PythonString::AsUTF8() const {
size_t PythonString::GetSize() const {
if (IsValid()) {
#if PY_MAJOR_VERSION >= 3
+#if PY_MINOR_VERSION >= 3
+ return PyUnicode_GetLength(m_py_obj);
+#else
return PyUnicode_GetSize(m_py_obj);
+#endif
#else
return PyString_Size(m_py_obj);
#endif
More information about the lldb-commits
mailing list