================
@@ -120,14 +120,30 @@ struct InitializePythonRAII {
       return spec.GetPath();
     }();
     if (!g_python_home.empty()) {
-      PyConfig_SetBytesString(&config, &config.home, g_python_home.c_str());
+      PyStatus status =
+          PyConfig_SetBytesString(&config, &config.home, 
g_python_home.c_str());
+      if (PyStatus_Exception(status)) {
+        PyConfig_Clear(&config);
+        llvm::WithColor::error()
+            << "Failed to set the Python config: '" << status.err_msg << 
"'.\n";
+        return;
----------------
charles-zablit wrote:

>From my tests, crashing is unavoidable due to the `PyGILState_Ensure` call 
>which crashes on an assert if Python is not properly initialized.

https://github.com/llvm/llvm-project/pull/181160
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to