[Lldb-commits] [lldb] r260721 - Adjust for Python-3.
Siva Chandra via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 12 12:30:47 PST 2016
Author: sivachandra
Date: Fri Feb 12 14:30:47 2016
New Revision: 260721
URL: http://llvm.org/viewvc/llvm-project?rev=260721&view=rev
Log:
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
Added:
lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux.py
- copied unchanged from r260720, lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux2.py
Removed:
lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux2.py
Modified:
lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
lldb/trunk/scripts/Python/modules/readline/readline.cpp
lldb/trunk/source/API/liblldb.exports
Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=260721&r1=260720&r2=260721&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Fri Feb 12 14:30:47 2016
@@ -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)
Removed: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux2.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux2.py?rev=260720&view=auto
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux2.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux2.py (removed)
@@ -1,4 +0,0 @@
-from builder_base import *
-
-def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
- return False
Modified: lldb/trunk/scripts/Python/modules/readline/readline.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/modules/readline/readline.cpp?rev=260721&r1=260720&r2=260721&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/modules/readline/readline.cpp (original)
+++ lldb/trunk/scripts/Python/modules/readline/readline.cpp Fri Feb 12 14:30:47 2016
@@ -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
}
Modified: lldb/trunk/source/API/liblldb.exports
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/liblldb.exports?rev=260721&r1=260720&r2=260721&view=diff
==============================================================================
--- lldb/trunk/source/API/liblldb.exports (original)
+++ lldb/trunk/source/API/liblldb.exports Fri Feb 12 14:30:47 2016
@@ -1,3 +1,4 @@
_ZN4lldb*
_ZNK4lldb*
init_lld*
+PyInit__lldb
More information about the lldb-commits
mailing list