diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2022-04-25 20:14:44 -0700 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2022-04-27 08:26:25 -0700 |
commit | 90537673302f13e92ffabba84901164c6b974b2d (patch) | |
tree | cd66c08919923e7809fa146451a4e8df47f0f847 /lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp | |
parent | 16baf59c6d0b3bf7392995e3e55fc9e2ba9cb5e7 (diff) | |
download | llvm-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/PythonReadline.cpp')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp index 95a3365..2753847f 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonReadline.cpp @@ -22,7 +22,6 @@ PyDoc_STRVAR(moduleDocumentation, "Simple readline module implementation based on libedit."); -#if PY_MAJOR_VERSION >= 3 static struct PyModuleDef readline_module = { PyModuleDef_HEAD_INIT, // m_base "lldb_editline", // m_name @@ -34,26 +33,13 @@ static struct PyModuleDef readline_module = { nullptr, // m_clear nullptr, // m_free }; -#else -static struct PyMethodDef moduleMethods[] = {{nullptr, nullptr, 0, nullptr}}; -#endif -static char * -#if PY_MAJOR_VERSION >= 3 -simple_readline(FILE *stdin, FILE *stdout, const char *prompt) -#else -simple_readline(FILE *stdin, FILE *stdout, char *prompt) -#endif -{ +static char *simple_readline(FILE *stdin, FILE *stdout, const char *prompt) { rl_instream = stdin; rl_outstream = stdout; char *line = readline(prompt); if (!line) { -#if PY_MAJOR_VERSION >= 3 char *ret = (char *)PyMem_RawMalloc(1); -#else - char *ret = (char *)PyMem_Malloc(1); -#endif if (ret != NULL) *ret = '\0'; return ret; @@ -61,11 +47,7 @@ simple_readline(FILE *stdin, FILE *stdout, char *prompt) if (*line) add_history(line); int n = strlen(line); -#if PY_MAJOR_VERSION >= 3 char *ret = (char *)PyMem_RawMalloc(n + 2); -#else - char *ret = (char *)PyMem_Malloc(n + 2); -#endif if (ret) { memcpy(ret, line, n); free(line); @@ -78,11 +60,6 @@ simple_readline(FILE *stdin, FILE *stdout, char *prompt) PyMODINIT_FUNC initlldb_readline(void) { PyOS_ReadlineFunctionPointer = simple_readline; -#if PY_MAJOR_VERSION >= 3 return PyModule_Create(&readline_module); -#else - Py_InitModule4("readline", moduleMethods, moduleDocumentation, - static_cast<PyObject *>(NULL), PYTHON_API_VERSION); -#endif } #endif |