llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Daniel Xu (danobi)
<details>
<summary>Changes</summary>
Previously python was initialized during static registration of the plugin.
This causes the python interpreter to run even if python support is explicitly
disabled thru:
SBDebugger::SetScriptLanguage(ScriptLanguage::eScriptLanguageNone)
This commit defers python initialization until a ScriptInterpreterPython
instance is created.
---
Full diff: https://github.com/llvm/llvm-project/pull/105757.diff
1 Files Affected:
- (modified)
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (+4-1)
``````````diff
diff --git
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 335c482f8495ad..bc4e7485067048 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -352,7 +352,6 @@ void ScriptInterpreterPython::Initialize() {
GetPluginDescriptionStatic(),
lldb::eScriptLanguagePython,
ScriptInterpreterPythonImpl::CreateInstance);
- ScriptInterpreterPythonImpl::Initialize();
});
}
@@ -429,6 +428,10 @@
ScriptInterpreterPythonImpl::ScriptInterpreterPythonImpl(Debugger &debugger)
m_active_io_handler(eIOHandlerNone), m_session_is_active(false),
m_pty_secondary_is_open(false), m_valid_session(true), m_lock_count(0),
m_command_thread_state(nullptr) {
+ static llvm::once_flag g_once_flag;
+ llvm::call_once(g_once_flag, []() {
+ ScriptInterpreterPythonImpl::Initialize();
+ });
m_dictionary_name.append("_dict");
StreamString run_string;
``````````
</details>
https://github.com/llvm/llvm-project/pull/105757
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits