From c154f397eeb86ea1a5b8fa46405104ace962cec3 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Mon, 17 Jan 2022 11:29:35 +0100 Subject: [lldb/python] Use PythonObject in LLDBSwigPython functions Return our PythonObject wrappers instead of raw PyObjects (obfuscated as void *). This ensures that ownership (reference counts) of python objects is automatically tracked. Differential Revision: https://reviews.llvm.org/D117462 --- lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp') diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp index d68af67..13dabb2 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp @@ -280,7 +280,8 @@ StructuredData::ObjectSP PythonObject::CreateStructuredObject() const { case PyObjectType::None: return StructuredData::ObjectSP(); default: - return StructuredData::ObjectSP(new StructuredPythonObject(m_py_obj)); + return StructuredData::ObjectSP(new StructuredPythonObject( + PythonObject(PyRefType::Borrowed, m_py_obj))); } } -- cgit v1.1