aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2022-04-25 20:14:44 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2022-04-27 08:26:25 -0700
commit90537673302f13e92ffabba84901164c6b974b2d (patch)
treecd66c08919923e7809fa146451a4e8df47f0f847 /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
parent16baf59c6d0b3bf7392995e3e55fc9e2ba9cb5e7 (diff)
downloadllvm-90537673302f13e92ffabba84901164c6b974b2d.zip
llvm-90537673302f13e92ffabba84901164c6b974b2d.tar.gz
llvm-90537673302f13e92ffabba84901164c6b974b2d.tar.bz2
Remove Python 2 support from the ScriptInterpreter plugin
We dropped downstream support for Python 2 in the previous release. Now that we have branched for the next release the window where this kind of change could introduce conflicts is closing too. Start by getting rid of Python 2 support in the Script Interpreter plugin. Differential revision: https://reviews.llvm.org/D124429
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp28
1 files changed, 1 insertions, 27 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index d9943f0..53e2bcac 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -60,17 +60,10 @@ using llvm::Expected;
LLDB_PLUGIN_DEFINE(ScriptInterpreterPython)
// Defined in the SWIG source file
-#if PY_MAJOR_VERSION >= 3
extern "C" PyObject *PyInit__lldb(void);
#define LLDBSwigPyInit PyInit__lldb
-#else
-extern "C" void init_lldb(void);
-
-#define LLDBSwigPyInit init_lldb
-#endif
-
#if defined(_WIN32)
// Don't mess with the signal handlers on Windows.
#define LLDB_USE_PYTHON_SET_INTERRUPT 0
@@ -145,11 +138,7 @@ public:
private:
void InitializePythonHome() {
#if LLDB_EMBED_PYTHON_HOME
-#if PY_MAJOR_VERSION >= 3
- typedef wchar_t* str_type;
-#else
- typedef char* str_type;
-#endif
+ typedef wchar_t *str_type;
static str_type g_python_home = []() -> str_type {
const char *lldb_python_home = LLDB_PYTHON_HOME;
const char *absolute_python_home = nullptr;
@@ -164,27 +153,12 @@ private:
llvm::sys::path::append(path, lldb_python_home);
absolute_python_home = path.c_str();
}
-#if PY_MAJOR_VERSION >= 3
size_t size = 0;
return Py_DecodeLocale(absolute_python_home, &size);
-#else
- return strdup(absolute_python_home);
-#endif
}();
if (g_python_home != nullptr) {
Py_SetPythonHome(g_python_home);
}
-#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 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.
- static char path[] =
- "/System/Library/Frameworks/Python.framework/Versions/2.7";
- Py_SetPythonHome(path);
-#endif
#endif
}