diff options
author | Vadim Chugunov <vadimcn@gmail.com> | 2018-10-14 07:24:56 +0000 |
---|---|---|
committer | Vadim Chugunov <vadimcn@gmail.com> | 2018-10-14 07:24:56 +0000 |
commit | 74587a0e489dec97780404f064b7768c7ab6df22 (patch) | |
tree | a52960b372e98e10fe93064242af850970f7b65a /lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | |
parent | 5118c68cde1ab1a70ca61e3e75cab48653dfd5b9 (diff) | |
download | bcm5719-llvm-74587a0e489dec97780404f064b7768c7ab6df22.tar.gz bcm5719-llvm-74587a0e489dec97780404f064b7768c7ab6df22.zip |
Fix double import of _lldb module.
Fix llvm.org/pr39054:
- Register _lldb as a built-in module during initialization of script interpreter,
- Reverse the order of imports in __init__.py: first try to import by absolute name, which will find the built-in module in the context of lldb (and other hosts that embed liblldb), then try relative import, in case the module is being imported from Python interpreter.
This works for SWIG>=3.0.11; before that, SWIG did not support custom module import code.
Differential revision: https://reviews.llvm.org/D52404
llvm-svn: 344474
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp')
-rw-r--r-- | lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index bc6ed6cbdf9..0db28294ebd 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -132,6 +132,9 @@ public: InitializePythonHome(); + // Register _lldb as a built-in module. + PyImport_AppendInittab("_lldb", g_swig_init_callback); + // Python < 3.2 and Python >= 3.2 reversed the ordering requirements for // calling `Py_Initialize` and `PyEval_InitThreads`. < 3.2 requires that you // call `PyEval_InitThreads` first, and >= 3.2 requires that you call it last. |