This revision was automatically updated to reflect the committed changes. Closed by commit rL344474: Fix double import of _lldb module. (authored by vadimcn, committed by ). Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D52404?vs=166627&id=169595#toc Repository: rL LLVM https://reviews.llvm.org/D52404 Files: lldb/trunk/scripts/lldb.swig lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Index: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp =================================================================== --- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -132,6 +132,9 @@ 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. Index: lldb/trunk/scripts/lldb.swig =================================================================== --- lldb/trunk/scripts/lldb.swig +++ lldb/trunk/scripts/lldb.swig @@ -41,12 +41,12 @@ */ %define MODULEIMPORT "try: - # Try a relative import first - from . import $module + # Try an absolute import first. If we're being loaded from lldb, + # _lldb should be a built-in module. + import $module except ImportError: - # Maybe absolute import will work (if we're being loaded from lldb, it - # should). - import $module" + # Relative import should work if we are being loaded by Python. + from . import $module" %enddef // These versions will not generate working python modules, so error out early. #if SWIG_VERSION >= 0x030009 && SWIG_VERSION < 0x030011
Index: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp =================================================================== --- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -132,6 +132,9 @@ 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. Index: lldb/trunk/scripts/lldb.swig =================================================================== --- lldb/trunk/scripts/lldb.swig +++ lldb/trunk/scripts/lldb.swig @@ -41,12 +41,12 @@ */ %define MODULEIMPORT "try: - # Try a relative import first - from . import $module + # Try an absolute import first. If we're being loaded from lldb, + # _lldb should be a built-in module. + import $module except ImportError: - # Maybe absolute import will work (if we're being loaded from lldb, it - # should). - import $module" + # Relative import should work if we are being loaded by Python. + from . import $module" %enddef // These versions will not generate working python modules, so error out early. #if SWIG_VERSION >= 0x030009 && SWIG_VERSION < 0x030011
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits