summaryrefslogtreecommitdiff
path: root/lldb/bindings/python/python.swig
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/bindings/python/python.swig')
-rw-r--r--lldb/bindings/python/python.swig12
1 files changed, 11 insertions, 1 deletions
diff --git a/lldb/bindings/python/python.swig b/lldb/bindings/python/python.swig
index 4a5a39dc4b06..3d2caa65f165 100644
--- a/lldb/bindings/python/python.swig
+++ b/lldb/bindings/python/python.swig
@@ -50,7 +50,12 @@ Older swig versions will simply ignore this setting.
import $module
except ImportError:
# Relative import should work if we are being loaded by Python.
- from . import $module"
+ # The cpython module built by swig is pushed one level down into
+ # the native submodule, because at this point the interpreter
+ # is still constructing the lldb module itself.
+ # Simply importing anything using `from . import` constitutes
+ # a cyclic importing.
+ from .native import $module"
%enddef
// The name of the module to be created.
@@ -59,6 +64,11 @@ except ImportError:
// Parameter types will be used in the autodoc string.
%feature("autodoc", "1");
+// Include lldb-python first as it sets Py_LIMITED_API.
+%begin %{
+#include "../source/Plugins/ScriptInterpreter/Python/lldb-python.h"
+%}
+
%pythoncode%{
import uuid
import re