aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
diff options
context:
space:
mode:
authorVladislav Dzhidzhoev <vdzhidzhoev@accesssoftek.com>2025-04-18 22:16:35 +0200
committerGitHub <noreply@github.com>2025-04-18 22:16:35 +0200
commit058992ea9fc62a9f79ab90eaebecb267469795a7 (patch)
treef0b53972d34611ed6824f954d7e1c07f60475014 /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
parent15e662bf0646200d1fbe28a651fc8d4247bd13cf (diff)
downloadllvm-058992ea9fc62a9f79ab90eaebecb267469795a7.zip
llvm-058992ea9fc62a9f79ab90eaebecb267469795a7.tar.gz
llvm-058992ea9fc62a9f79ab90eaebecb267469795a7.tar.bz2
[lldb] Fix Python GIL-not-held issue in CreateStructuredDataFromScriptObject (#136309)
TestStructuredDataAPI.py fails with Python debug build ver. 3.12+ due to call to Py_XINCREF while GIL is not held.
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index a9c8127..553ee7e 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();
}