https://github.com/JDevlieghere updated 
https://github.com/llvm/llvm-project/pull/169065

>From 2804dc31b465de8e11973eac90cef131fe8aa576 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <[email protected]>
Date: Fri, 21 Nov 2025 09:05:37 -0800
Subject: [PATCH 1/2] [lldb] Don't enable the Limited C API with Python 3.13
 and SWIG 4.4.0

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
---
 lldb/cmake/modules/LLDBConfig.cmake | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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()

>From 2232110debb0f319fe93a8a5248283a9b78c3910 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <[email protected]>
Date: Fri, 21 Nov 2025 09:22:03 -0800
Subject: [PATCH 2/2] Python 3.14 is affected as well

---
 lldb/cmake/modules/LLDBConfig.cmake | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index f3240055316cd..9509859344bc5 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -182,7 +182,7 @@ 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")
+  set(AFFECTED_BY_SWIG_BUG SWIG_VERSION VERSION_EQUAL "4.4.0" AND 
Python3_VERSION VERSION_GREATER_EQUAL "3.13")
   if (SWIG_VERSION VERSION_GREATER_EQUAL PYTHON_LIMITED_API_MIN_SWIG_VERSION
       AND NOT LLDB_EMBED_PYTHON_HOME AND NOT AFFECTED_BY_SWIG_BUG)
     set(default_enable_python_limited_api ON)

_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to