================
@@ -134,9 +115,30 @@ struct InitializePythonRAII {
       PyImport_AppendInittab("_lldb", LLDBSwigPyInit);
     }
 
+#if LLDB_EMBED_PYTHON_HOME
----------------
JDevlieghere wrote:

Part of it, yes, but you could avoid changing the order by splitting the 
ifdef-ed code in two, which is slightly messier. I enabled 
`LLDB_EMBED_PYTHON_HOME` on Darwin and there it doesn't matter. That would look 
like this:

```
#if LLDB_EMBED_PYTHON_HOME
  PyConfig config;
  [...]
  PyConfig_SetBytesString(&config, &config.home, g_python_home.c_str());
#endif 

  if (!Py_IsInitialized()) {
        [...]
    PyImport_AppendInittab("_lldb", LLDBSwigPyInit);
  }
  
#if LLDB_EMBED_PYTHON_HOME  
    config.install_signal_handlers = 0;
    Py_InitializeFromConfig(&config);
    PyConfig_Clear(&config);
#else
    Py_InitializeEx(/*install_sigs=*/0);
#endif
```

https://github.com/llvm/llvm-project/pull/152588
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to