[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
[ScriptInterpreter] Make sure that PYTHONHOME is right.

For the only version of Python actually supported on Darwin.


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
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:
+#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");
   void InitializeThreadsPrivate() {

More information about the lldb-commits mailing list