Skip to content

Revert "Push down the swig module to avoid an import cycle" #129714

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

DavidSpickett
Copy link
Collaborator

Reverts #129135 due to buildbot test failures.

Definitely caused remote Linux to Windows failures (https://lab.llvm.org/buildbot/#/builders/197/builds/2712), may be the cause of Windows on Arm failures https://lab.llvm.org/buildbot/#/builders/141/builds/6744.

@llvmbot llvmbot added the lldb label Mar 4, 2025
@DavidSpickett DavidSpickett merged commit 2af0e2f into main Mar 4, 2025
8 of 11 checks passed
@llvmbot
Copy link
Member

llvmbot commented Mar 4, 2025

@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)

Changes

Reverts llvm/llvm-project#129135 due to buildbot test failures.

Definitely caused remote Linux to Windows failures (https://lab.llvm.org/buildbot/#/builders/197/builds/2712), may be the cause of Windows on Arm failures https://lab.llvm.org/buildbot/#/builders/141/builds/6744.


Full diff: https://github.com/llvm/llvm-project/pull/129714.diff

2 Files Affected:

  • (modified) lldb/bindings/python/CMakeLists.txt (+2-6)
  • (modified) lldb/bindings/python/python.swig (+1-6)
diff --git a/lldb/bindings/python/CMakeLists.txt b/lldb/bindings/python/CMakeLists.txt
index c4bf74e094f00..69306a384e0b1 100644
--- a/lldb/bindings/python/CMakeLists.txt
+++ b/lldb/bindings/python/CMakeLists.txt
@@ -59,10 +59,8 @@ endfunction()
 function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_target_dir)
   # Add a Post-Build Event to copy over Python files and create the symlink to
   # liblldb.so for the Python API(hardlink on Windows).
-  # Note that Swig-generated code is located one level deeper in the `native`
-  # module, in order to avoid cyclic importing.
   add_custom_target(${swig_target} ALL VERBATIM
-    COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_python_target_dir}/native/
+    COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_python_target_dir}
     DEPENDS ${lldb_python_bindings_dir}/lldb.py
     COMMENT "Python script sym-linking LLDB Python API")
 
@@ -76,8 +74,6 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
       "${LLDB_SOURCE_DIR}/source/Interpreter/embedded_interpreter.py"
       "${lldb_python_target_dir}")
 
-  create_python_package(${swig_target} ${lldb_python_target_dir} "native" FILES)
-
   # Distribute the examples as python packages.
   create_python_package(
     ${swig_target}
@@ -145,7 +141,7 @@ function(finish_swig_python swig_target lldb_python_bindings_dir lldb_python_tar
   endif()
   set(LIBLLDB_SYMLINK_OUTPUT_FILE "_lldb${LLDB_PYTHON_EXT_SUFFIX}")
   create_relative_symlink(${swig_target} ${LIBLLDB_SYMLINK_DEST}
-                          ${lldb_python_target_dir}/native/ ${LIBLLDB_SYMLINK_OUTPUT_FILE})
+                          ${lldb_python_target_dir} ${LIBLLDB_SYMLINK_OUTPUT_FILE})
 
 
   if (NOT WIN32)
diff --git a/lldb/bindings/python/python.swig b/lldb/bindings/python/python.swig
index f1b156624e8d8..278c0eed2bab2 100644
--- a/lldb/bindings/python/python.swig
+++ b/lldb/bindings/python/python.swig
@@ -50,12 +50,7 @@ Older swig versions will simply ignore this setting.
     import $module
 except ImportError:
     # Relative import should work if we are being loaded by Python.
-    # 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"
+    from . import $module"
 %enddef
 
 // The name of the module to be created.

@DavidSpickett DavidSpickett deleted the revert-129135-push-down-lldb-cpython branch March 4, 2025 14:24
jph-13 pushed a commit to jph-13/llvm-project that referenced this pull request Mar 21, 2025
)

Reverts llvm#129135 due to buildbot test failures.

Definitely caused remote Linux to Windows failures
(https://lab.llvm.org/buildbot/#/builders/197/builds/2712), may be the
cause of Windows on Arm failures
https://lab.llvm.org/buildbot/#/builders/141/builds/6744.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants