[Lldb-commits] [lldb] r250531 - Fix linkage of `init_lldb` SWIG method in Python 3.
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Fri Oct 16 10:52:04 PDT 2015
Author: zturner
Date: Fri Oct 16 12:52:03 2015
New Revision: 250531
URL: http://llvm.org/viewvc/llvm-project?rev=250531&view=rev
Log:
Fix linkage of `init_lldb` SWIG method in Python 3.
Modified:
lldb/trunk/source/API/SystemInitializerFull.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
Modified: lldb/trunk/source/API/SystemInitializerFull.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=250531&r1=250530&r2=250531&view=diff
==============================================================================
--- lldb/trunk/source/API/SystemInitializerFull.cpp (original)
+++ lldb/trunk/source/API/SystemInitializerFull.cpp Fri Oct 16 12:52:03 2015
@@ -89,9 +89,19 @@ using namespace lldb_private;
#ifndef LLDB_DISABLE_PYTHON
// 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
+
// these are the Pythonic implementations of the required callbacks
// these are scripting-language specific, which is why they belong here
// we still need to use function pointers to them instead of relying
@@ -328,7 +338,7 @@ void SystemInitializerFull::InitializeSW
{
#if !defined(LLDB_DISABLE_PYTHON)
ScriptInterpreterPython::InitializeInterpreter(
- init_lldb,
+ LLDBSwigPyInit,
LLDBSwigPythonBreakpointCallbackFunction,
LLDBSwigPythonWatchpointCallbackFunction,
LLDBSwigPythonCallTypeScript,
Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h?rev=250531&r1=250530&r2=250531&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h (original)
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h Fri Oct 16 12:52:03 2015
@@ -32,7 +32,11 @@ class ScriptInterpreterPython :
public IOHandlerDelegateMultiline
{
public:
- typedef void (*SWIGInitCallback) (void);
+#if PY_MAJOR_VERSION >= 3
+ typedef PyObject*(*SWIGInitCallback) (void);
+#else
+ typedef void(*SWIGInitCallback) (void);
+#endif
typedef bool (*SWIGBreakpointCallbackFunction) (const char *python_function_name,
const char *session_dictionary_name,
More information about the lldb-commits
mailing list