diff options
Diffstat (limited to 'lldb/source')
-rw-r--r-- | lldb/source/API/SystemInitializerFull.cpp | 12 | ||||
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h | 6 |
2 files changed, 16 insertions, 2 deletions
diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp index d9fbbf99178..d3df421da2c 100644 --- a/lldb/source/API/SystemInitializerFull.cpp +++ b/lldb/source/API/SystemInitializerFull.cpp @@ -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::InitializeSWIG() { #if !defined(LLDB_DISABLE_PYTHON) ScriptInterpreterPython::InitializeInterpreter( - init_lldb, + LLDBSwigPyInit, LLDBSwigPythonBreakpointCallbackFunction, LLDBSwigPythonWatchpointCallbackFunction, LLDBSwigPythonCallTypeScript, diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h index 0f613e5842c..0cdb9c054eb 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h @@ -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, |