[Lldb-commits] [lldb] r356816 - [ScriptInterpreter] Make sure that PYTHONHOME is right.

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 22 15:19:57 PDT 2019


Author: davide
Date: Fri Mar 22 15:19:57 2019
New Revision: 356816

URL: http://llvm.org/viewvc/llvm-project?rev=356816&view=rev
Log:
[ScriptInterpreter] Make sure that PYTHONHOME is right.

Summary:
For the only version of Python actually supported on Darwin.

<rdar://problem/40961425>

Reviewers: jingham, friss, JDevlieghere, aprantl, jasonmolenda

Subscribers: jdoerfert, llvm-commits, lldb-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D59719

Modified:
    lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=356816&r1=356815&r2=356816&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Fri Mar 22 15:19:57 2019
@@ -177,6 +177,16 @@ private:
 #endif
     Py_SetPythonHome(g_python_home);
 #endif
+#else
+#if defined(__APPLE__) && PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 7
+    // 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
   }
 
   void InitializeThreadsPrivate() {




More information about the lldb-commits mailing list