From 90537673302f13e92ffabba84901164c6b974b2d Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 25 Apr 2022 20:14:44 -0700 Subject: 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 --- .../Python/ScriptInterpreterPython.cpp | 28 +--------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp') 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 } -- cgit v1.1