diff options
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 |