[Lldb-commits] [lldb] [lldb] Don't fail initialization when Python can't be loaded (PR #229891)
Alex Langford via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 7 14:55:42 PDT 2026
================
@@ -49,18 +49,15 @@ llvm::Error SystemInitializerFull::Initialize() {
return error;
#if LLDB_ENABLE_PYTHON
- // Map libpython into the process before any code that might reference it
- // runs. This is required by both the static script interpreter (whose
- // Initialize() invokes Python via the LLDB_PLUGIN_INITIALIZE loop below)
- // and the dynamic plugin (whose dlopen needs Python's symbols visible in
- // the process). The loader is once_flag-cached and a no-op when libpython
- // is already in the process (e.g. `import lldb` from Python).
- llvm::Expected<ScriptInterpreterRuntimeLoader &> python_loader =
- ScriptInterpreterRuntimeLoader::Get(lldb::eScriptLanguagePython);
- if (!python_loader)
- return python_loader.takeError();
- if (llvm::Error err = python_loader->Load())
- return err;
+ // The dynamic script interpreter plugin references Python data symbols (type
+ // and exception objects), which can't be bound lazily, so Python must be
+ // mapped before loading the plugin. Failure isn't fatal, and can be handled
+ // when initializing the plugin.
----------------
bulbazord wrote:
Is there a way we can log the error or otherwise inform the user? I imagine you'll type `script` and it'll give you an error then, but that would suck if you're in a long debug session and need to re-launch LLDB to fix it.
https://github.com/llvm/llvm-project/pull/229891
More information about the lldb-commits
mailing list