[Lldb-commits] [PATCH] D59719: [ScriptInterpreter] Make sure that PYTHONHOME is right.

Davide Italiano via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 22 14:43:03 PDT 2019


davide created this revision.
davide added reviewers: jingham, friss, JDevlieghere, aprantl, jasonmolenda.
Herald added subscribers: llvm-commits, jdoerfert.
Herald added a project: LLVM.

For the only version of Python actually supported on Darwin.

rdar://problem/40961425


Repository:
  rL LLVM

https://reviews.llvm.org/D59719

Files:
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp


Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===================================================================
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -176,6 +176,16 @@
     static char g_python_home[] = LLDB_PYTHON_HOME;
 #endif
     Py_SetPythonHome(g_python_home);
+#endif
+#else
+#if defined(__APPLE__) && PY_MAJOR_VERSION == 2
+    // For Darwin, the only Python version supported is the one shipped in the OS
+    // and linked with lldb. Other installation of Python may have higher priorities
+    // in the path, overriding PYTHONHOME and causing problems/incompatibilities.
+    // In order to avoid confusion, always hardcode the PythonHome to be right,
+    // as it's not going to change.
+    Py_SetPythonHome("/System/Library/Frameworks/Python.framework/Versions/2.7");
+#endif
 #endif
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59719.191953.patch
Type: text/x-patch
Size: 962 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190322/f43cf8c9/attachment.bin>


More information about the lldb-commits mailing list