[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
This commit is contained in:
Pavel Labath
2022-01-17 11:29:35 +01:00
parent cc0d208805
commit c154f397ee
8 changed files with 154 additions and 181 deletions

View File

@@ -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)));
}
}