[Mlir-commits] [mlir] [mlir][python] Link Windows stable ABI extensions against Python::SABIModule (PR #225794)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Sep 23 07:32:05 PDT 2026
https://github.com/miyanyan updated https://github.com/llvm/llvm-project/pull/225794
>From d44d2e5a57cbf7e34c61696c3c1c0d4b5fb7e4b3 Mon Sep 17 00:00:00 2001
From: miyanyan <1138989048 at qq.com>
Date: Wed, 23 Sep 2026 22:25:06 +0800
Subject: [PATCH] [mlir][python] Avoid versioned Python DLL with stable ABI on
Windows
---
mlir/cmake/modules/AddMLIRPython.cmake | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mlir/cmake/modules/AddMLIRPython.cmake b/mlir/cmake/modules/AddMLIRPython.cmake
index 1e483116569a06..3607cd9225041a 100644
--- a/mlir/cmake/modules/AddMLIRPython.cmake
+++ b/mlir/cmake/modules/AddMLIRPython.cmake
@@ -1129,7 +1129,8 @@ function(add_mlir_python_extension libname extname nb_library_target_name)
$<$<PLATFORM_ID:Linux>:LINKER:--exclude-libs,ALL>
)
- if(WIN32)
+ # nanobind already links stable ABI targets against Python::SABIModule.
+ if(WIN32 AND (NOT MLIR_ENABLE_PYTHON_STABLE_ABI OR NB_ABI MATCHES "[0-9]t"))
# On Windows, pyconfig.h (and by extension python.h) hardcode the version of the
# python library which will be used for linkage depending on the flavor of the build.
# nanobind has a workaround which depends on the definition of Py_DEBUG (if Py_DEBUG
More information about the Mlir-commits
mailing list