aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp1
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp5
2 files changed, 3 insertions, 3 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
index b07415e..e124954 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp
@@ -261,7 +261,6 @@ PythonObject PythonObject::GetAttributeValue(llvm::StringRef attr) const {
}
StructuredData::ObjectSP PythonObject::CreateStructuredObject() const {
- assert(PyGILState_Check());
switch (GetObjectType()) {
case PyObjectType::Dictionary:
return PythonDictionary(PyRefType::Borrowed, m_py_obj)
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index adc172c..24d604f 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -139,11 +139,12 @@ public:
PyConfig_Clear(&config);
// The only case we should go further and acquire the GIL: it is unlocked.
- if (PyGILState_Check())
+ PyGILState_STATE gil_state = PyGILState_Ensure();
+ if (gil_state != PyGILState_UNLOCKED)
return;
m_was_already_initialized = true;
- m_gil_state = PyGILState_Ensure();
+ m_gil_state = gil_state;
LLDB_LOGV(GetLog(LLDBLog::Script),
"Ensured PyGILState. Previous state = {0}",
m_gil_state == PyGILState_UNLOCKED ? "unlocked" : "locked");