Author: Jonas Devlieghere
Date: 2025-11-21T17:27:17Z
New Revision: 55d8b63195882d07ec4dc390d2c558bebc4e295d

URL: 
https://github.com/llvm/llvm-project/commit/55d8b63195882d07ec4dc390d2c558bebc4e295d
DIFF: 
https://github.com/llvm/llvm-project/commit/55d8b63195882d07ec4dc390d2c558bebc4e295d.diff

LOG: [lldb] Don't enable the Limited C API with Python 3.13 and SWIG 4.4.0 
(#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: https://github.com/swig/swig/issues/3283
SWIG PR: https://github.com/swig/swig/pull/3285

Added: 
    

Modified: 
    lldb/cmake/modules/LLDBConfig.cmake

Removed: 
    


################################################################################
diff  --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index 89da2341839bc..9509859344bc5 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_GREATER_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()


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

Reply via email to