[Lldb-commits] [lldb] [lldb] Fix Python GIL-not-held issue in CreateStructuredDataFromScriptObject (PR #136309)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Apr 18 07:26:32 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Vladislav Dzhidzhoev (dzhidzhoev)
<details>
<summary>Changes</summary>
TestStructuredDataAPI.py fails with Python debug build ver. 3.12+ due to call to Py_XINCREF while GIL is not held.
---
Full diff: https://github.com/llvm/llvm-project/pull/136309.diff
1 Files Affected:
- (modified) lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (+1-1)
``````````diff
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index a9c81273c1302..553ee7e80b359 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -1569,10 +1569,10 @@ StructuredData::ObjectSP
ScriptInterpreterPythonImpl::CreateStructuredDataFromScriptObject(
ScriptObject obj) {
void *ptr = const_cast<void *>(obj.GetPointer());
+ Locker py_lock(this, Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock);
PythonObject py_obj(PyRefType::Borrowed, static_cast<PyObject *>(ptr));
if (!py_obj.IsValid() || py_obj.IsNone())
return {};
- Locker py_lock(this, Locker::AcquireLock | Locker::NoSTDIN, Locker::FreeLock);
return py_obj.CreateStructuredObject();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/136309
More information about the lldb-commits
mailing list