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
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user