[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 committed 2022-01-18 10:28:58 +01:00
1 parent cc0d208805
commit c154f397ee
8 files changed
+154 -181

No files matched your search

@@ -43,7 +43,7 @@ StructuredData::GenericSP ScriptedThreadPythonInterface::CreatePluginObject(
Locker py_lock(&m_interpreter, Locker::AcquireLock | Locker::NoSTDIN,
Locker::FreeLock);
void *ret_val = LLDBSwigPythonCreateScriptedThread(
PythonObject ret_val = LLDBSwigPythonCreateScriptedThread(
class_name.str().c_str(), m_interpreter.GetDictionaryName(), process_sp,
args_impl, error_string);
@@ -51,7 +51,7 @@ StructuredData::GenericSP ScriptedThreadPythonInterface::CreatePluginObject(
return {};
m_object_instance_sp =
StructuredData::GenericSP(new StructuredPythonObject(ret_val));
StructuredData::GenericSP(new StructuredPythonObject(std::move(ret_val)));
return m_object_instance_sp;
}