[Lldb-commits] [lldb] [lldb] Don't enable the Limited C API with Python 3.13 and SWIG 4.4.0 (PR #169065)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Nov 21 09:08:41 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Jonas Devlieghere (JDevlieghere)
<details>
<summary>Changes</summary>
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: https://github.com/swig/swig/issues/3283
SWIG PR: https://github.com/swig/swig/pull/3285
---
Full diff: https://github.com/llvm/llvm-project/pull/169065.diff
1 Files Affected:
- (modified) lldb/cmake/modules/LLDBConfig.cmake (+6-1)
``````````diff
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()
``````````
</details>
https://github.com/llvm/llvm-project/pull/169065
More information about the lldb-commits
mailing list