diff options
| author | Siva Chandra <sivachandra@google.com> | 2016-02-12 20:30:47 +0000 |
|---|---|---|
| committer | Siva Chandra <sivachandra@google.com> | 2016-02-12 20:30:47 +0000 |
| commit | 29d9bea93f5efad391202e0e15f27d3bbf3bfd50 (patch) | |
| tree | acc8238058011dcf365761710146d2ac8f7f9eaf | |
| parent | 56d13e893749b5cc0d649fafd265ab52b1336e84 (diff) | |
| download | bcm5719-llvm-29d9bea93f5efad391202e0e15f27d3bbf3bfd50.tar.gz bcm5719-llvm-29d9bea93f5efad391202e0e15f27d3bbf3bfd50.zip | |
Adjust for Python-3.
Summary:
This does not yet give us a clean testsuite run but it does help with:
1. Actually building on linux
2. Run the testsuite with over 70% tests passing on linux.
Reviewers: tfiala, labath, zturner
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D17182
llvm-svn: 260721
| -rw-r--r-- | lldb/packages/Python/lldbsuite/test/lldbtest.py | 4 | ||||
| -rw-r--r-- | lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py (renamed from lldb/packages/Python/lldbsuite/test/plugins/builder_linux2.py) | 0 | ||||
| -rw-r--r-- | lldb/scripts/Python/modules/readline/readline.cpp | 34 | ||||
| -rw-r--r-- | lldb/source/API/liblldb.exports | 1 |
4 files changed, 34 insertions, 5 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 7bf2a5e663b..ac315fe8155 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -440,6 +440,10 @@ def builder_module(): return __import__("builder_freebsd") if sys.platform.startswith("netbsd"): return __import__("builder_netbsd") + if sys.platform.startswith("linux"): + # sys.platform with Python-3.x returns 'linux', but with + # Python-2.x it returns 'linux2'. + return __import__("builder_linux") return __import__("builder_" + sys.platform) diff --git a/lldb/packages/Python/lldbsuite/test/plugins/builder_linux2.py b/lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py index e56be429823..e56be429823 100644 --- a/lldb/packages/Python/lldbsuite/test/plugins/builder_linux2.py +++ b/lldb/packages/Python/lldbsuite/test/plugins/builder_linux.py diff --git a/lldb/scripts/Python/modules/readline/readline.cpp b/lldb/scripts/Python/modules/readline/readline.cpp index d66ccf4b6b7..d4b4962cc31 100644 --- a/lldb/scripts/Python/modules/readline/readline.cpp +++ b/lldb/scripts/Python/modules/readline/readline.cpp @@ -20,11 +20,6 @@ // work around LLVM pr18841 to avoid seg faults in the stock Python // readline.so linked against GNU readline. -static struct PyMethodDef moduleMethods[] = -{ - {nullptr, nullptr, 0, nullptr} -}; - #ifndef LLDB_DISABLE_LIBEDIT PyDoc_STRVAR( moduleDocumentation, @@ -35,9 +30,33 @@ PyDoc_STRVAR( "Stub module meant to avoid linking GNU readline."); #endif +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef readline_module = +{ + PyModuleDef_HEAD_INIT, // m_base + "readline", // m_name + moduleDocumentation, // m_doc + -1, // m_size + nullptr, // m_methods + nullptr, // m_reload + nullptr, // m_traverse + nullptr, // m_clear + nullptr, // m_free +}; +#else +static struct PyMethodDef moduleMethods[] = +{ + {nullptr, nullptr, 0, nullptr} +}; +#endif + #ifndef LLDB_DISABLE_LIBEDIT 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 { rl_instream = stdin; rl_outstream = stdout; @@ -67,10 +86,15 @@ initreadline(void) #ifndef LLDB_DISABLE_LIBEDIT PyOS_ReadlineFunctionPointer = simple_readline; #endif + +#if PY_MAJOR_VERSION >= 3 + return PyModule_Create(&readline_module); +#else Py_InitModule4( "readline", moduleMethods, moduleDocumentation, static_cast<PyObject *>(NULL), PYTHON_API_VERSION); +#endif } diff --git a/lldb/source/API/liblldb.exports b/lldb/source/API/liblldb.exports index fd234d11c40..2dc08e4dcb2 100644 --- a/lldb/source/API/liblldb.exports +++ b/lldb/source/API/liblldb.exports @@ -1,3 +1,4 @@ _ZN4lldb* _ZNK4lldb* init_lld* +PyInit__lldb |

