Skip to content

Commit 2384755

Browse files
burgholzerwjakob
authored andcommitted
Fix abi3t detection on Windows
scikit-build-core cannot encode abi3t in SKBUILD_SOABI on Windows and instead sets Py_TARGET_ABI3T. Honor that signal when deriving NB_ABI so split builds take the existing abi3t path. Exercise the fallback on Linux and Windows in split CI. Assisted-by: Codex
1 parent 300dc3f commit 2384755

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

.github/workflows/split.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,12 @@ jobs:
173173
# abi3t extensions (PEP 803) served by a free-threaded backend module.
174174
# Python 3.15 is only available as a prerelease at the moment
175175
abi3t:
176-
name: "split mode / Python 3.15t (abi3t) / ubuntu-latest"
177-
runs-on: ubuntu-latest
176+
strategy:
177+
matrix:
178+
os: ['ubuntu-latest', 'windows-latest']
179+
180+
name: "split mode / Python 3.15t (abi3t) / ${{ matrix.os }}"
181+
runs-on: ${{ matrix.os }}
178182

179183
steps:
180184
- uses: actions/checkout@v4
@@ -198,6 +202,7 @@ jobs:
198202
run: >
199203
cmake -S . -B build -DNB_TEST_SPLIT_MODE=ON
200204
-DNB_TEST_FREE_THREADED=ON
205+
-DPy_TARGET_ABI3T=1
201206
-DPython_EXECUTABLE="$(python -c 'import sys; print(sys.executable)')"
202207
203208
- name: Build C++

cmake/nanobind-config.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ endif()
5353
# Extract Python version and extensions (e.g. free-threaded build)
5454
string(REGEX REPLACE "[^-]*-([^-]*)-.*" "\\1" NB_ABI "${NB_SOABI}")
5555

56+
# Windows has no ABI-tagged extension suffix; scikit-build-core sets this instead
57+
if(Py_TARGET_ABI3T)
58+
set(NB_ABI "${Python_VERSION_MAJOR}${Python_VERSION_MINOR}t")
59+
endif()
60+
5661
# Determine whether the interpreter was built without the GIL using the ABI tag
5762
# (free-threaded builds encode this using a trailing 't').
5863
set(NB_FREE_THREADED 0)

0 commit comments

Comments
 (0)