Skip to content

Commit 2b1e750

Browse files
JDevlieghereaugusto2112
authored andcommitted
[lldb] Don't enable the Limited C API with Python 3.13 and SWIG 4.4.0 (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
1 parent 1ebe935 commit 2b1e750

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lldb/cmake/modules/LLDBConfig.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,21 @@ if (LLDB_ENABLE_PYTHON)
182182

183183
# Enable targeting the Python Limited C API.
184184
set(PYTHON_LIMITED_API_MIN_SWIG_VERSION "4.2")
185+
set(AFFECTED_BY_SWIG_BUG SWIG_VERSION VERSION_EQUAL "4.4.0" AND Python3_VERSION VERSION_GREATER_EQUAL "3.13")
185186
if (SWIG_VERSION VERSION_GREATER_EQUAL PYTHON_LIMITED_API_MIN_SWIG_VERSION
186-
AND NOT LLDB_EMBED_PYTHON_HOME)
187+
AND NOT LLDB_EMBED_PYTHON_HOME AND NOT AFFECTED_BY_SWIG_BUG)
187188
set(default_enable_python_limited_api ON)
188189
else()
189190
set(default_enable_python_limited_api OFF)
190191
endif()
192+
191193
option(LLDB_ENABLE_PYTHON_LIMITED_API "Force LLDB to only use the Python Limited API (requires SWIG 4.2 or later)"
192194
${default_enable_python_limited_api})
193195

194196
# Diagnose unsupported configurations.
197+
if (LLDB_ENABLE_PYTHON_LIMITED_API AND AFFECTED_BY_SWIG_BUG)
198+
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")
199+
endif()
195200
if (LLDB_ENABLE_PYTHON_LIMITED_API AND LLDB_EMBED_PYTHON_HOME)
196201
message(SEND_ERROR "LLDB_ENABLE_PYTHON_LIMITED_API is not compatible with LLDB_EMBED_PYTHON_HOME")
197202
endif()

0 commit comments

Comments
 (0)