From 3884e96e1b487343ea5c84d26f23685257bcb037 Mon Sep 17 00:00:00 2001 From: JSup Date: Thu, 23 Jul 2026 05:58:50 +0900 Subject: [PATCH] fix(setup): do not force abi3 wheel tag on free-threaded builds On free-threaded CPython (Py_GIL_DISABLED), the extension is already built without the limited API (py_limited_api = not Py_GIL_DISABLED), so the produced .so uses the full, version-specific ABI (e.g. _binding.cpython-314t-darwin.so). BdistWheel.get_tag, however, unconditionally rewrote any cp* wheel tag to cp310/abi3, mislabeling the free-threaded wheel as a stable-ABI (abi3) wheel. This produces a wheel whose tag does not match its contents, which breaks installation/import on free-threaded interpreters (tree-sitter/tree-sitter-python#337). Gate the abi3 rewrite on the same Py_GIL_DISABLED condition already used for py_limited_api so the wheel tag matches the ABI the extension was actually built against. GIL builds are unaffected and still tag cp310/abi3. Closes #337 Signed-off-by: JSup --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index fe677f15..aade4514 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ def build_extension(self, ext: Extension): class BdistWheel(bdist_wheel): def get_tag(self): python, abi, platform = super().get_tag() - if python.startswith("cp"): + if python.startswith("cp") and not get_config_var("Py_GIL_DISABLED"): python, abi = "cp310", "abi3" return python, abi, platform