Skip to content

Conversation

@JDevlieghere
Copy link
Member

@JDevlieghere JDevlieghere commented Nov 21, 2025

Don't automatically enable the Limited C API when we're targeting Python 3.13 or later in combination with SWIG 4.4.0 due to a bug in the latter.

SWIG Issue: swig/swig#3283
SWIG PR: swig/swig#3285

Don't automatically enable the Limited C API when we're using Python
3.13 and SWIG 4.4.0 due to a bug in SWIG.

SWIG Issue: swig/swig#3283
SWIG PR: swig/swig#3285
@llvmbot
Copy link
Member

llvmbot commented Nov 21, 2025

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

Changes

Don't automatically enable the Limited C API when we're using Python 3.13 and SWIG 4.4.0 due to a bug in SWIG.

SWIG Issue: swig/swig#3283
SWIG PR: swig/swig#3285


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

1 Files Affected:

  • (modified) lldb/cmake/modules/LLDBConfig.cmake (+6-1)
diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake
index 89da2341839bc..f3240055316cd 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -182,16 +182,21 @@ if (LLDB_ENABLE_PYTHON)
 
   # Enable targeting the Python Limited C API.
   set(PYTHON_LIMITED_API_MIN_SWIG_VERSION "4.2")
+  set(AFFECTED_BY_SWIG_BUG SWIG_VERSION VERSION_EQUAL "4.4.0" AND Python3_VERSION VERSION_EQUAL "3.13")
   if (SWIG_VERSION VERSION_GREATER_EQUAL PYTHON_LIMITED_API_MIN_SWIG_VERSION
-      AND NOT LLDB_EMBED_PYTHON_HOME)
+      AND NOT LLDB_EMBED_PYTHON_HOME AND NOT AFFECTED_BY_SWIG_BUG)
     set(default_enable_python_limited_api ON)
   else()
     set(default_enable_python_limited_api OFF)
   endif()
+
   option(LLDB_ENABLE_PYTHON_LIMITED_API "Force LLDB to only use the Python Limited API (requires SWIG 4.2 or later)"
     ${default_enable_python_limited_api})
 
   # Diagnose unsupported configurations.
+  if (LLDB_ENABLE_PYTHON_LIMITED_API AND AFFECTED_BY_SWIG_BUG)
+    message(SEND_ERROR "LLDB_ENABLE_PYTHON_LIMITED_API is not compatible with SWIG 4.4.0 and Python 3.13 due to a bug in SWIG: https://github.com/swig/swig/issues/3283")
+  endif()
   if (LLDB_ENABLE_PYTHON_LIMITED_API AND LLDB_EMBED_PYTHON_HOME)
     message(SEND_ERROR "LLDB_ENABLE_PYTHON_LIMITED_API is not compatible with LLDB_EMBED_PYTHON_HOME")
   endif()

@JDevlieghere JDevlieghere enabled auto-merge (squash) November 21, 2025 17:15
@JDevlieghere JDevlieghere enabled auto-merge (squash) November 21, 2025 17:23
@JDevlieghere JDevlieghere merged commit 55d8b63 into llvm:main Nov 21, 2025
7 of 9 checks passed
@JDevlieghere JDevlieghere deleted the swig-4.4.0-workaround branch November 21, 2025 17:31
swift-ci pushed a commit to swiftlang/llvm-project that referenced this pull request Nov 21, 2025
…llvm#169065)

Don't automatically enable the Limited C API when we're targeting Python
3.13 or later in combination with SWIG 4.4.0 due to a bug in the latter.

SWIG Issue: swig/swig#3283
SWIG PR: swig/swig#3285

(cherry picked from commit 55d8b63)
aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
…llvm#169065)

Don't automatically enable the Limited C API when we're targeting Python
3.13 or later in combination with SWIG 4.4.0 due to a bug in the latter.

SWIG Issue: swig/swig#3283
SWIG PR: swig/swig#3285
Priyanshu3820 pushed a commit to Priyanshu3820/llvm-project that referenced this pull request Nov 26, 2025
…llvm#169065)

Don't automatically enable the Limited C API when we're targeting Python
3.13 or later in combination with SWIG 4.4.0 due to a bug in the latter.

SWIG Issue: swig/swig#3283
SWIG PR: swig/swig#3285
augusto2112 pushed a commit to augusto2112/llvm-project that referenced this pull request Dec 3, 2025
…llvm#169065)

Don't automatically enable the Limited C API when we're targeting Python
3.13 or later in combination with SWIG 4.4.0 due to a bug in the latter.

SWIG Issue: swig/swig#3283
SWIG PR: swig/swig#3285
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.

4 participants