From 30395ddcb54d6c0f9087270283f58a95608fbe1c Mon Sep 17 00:00:00 2001 From: Charlie Lin Date: Wed, 22 Oct 2025 14:12:43 +0000 Subject: [PATCH] Do not build ABI3 wheel with no-GIL interpreters --- bindings/python/setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bindings/python/setup.py b/bindings/python/setup.py index 52cbbff38a..fb38263543 100755 --- a/bindings/python/setup.py +++ b/bindings/python/setup.py @@ -7,6 +7,7 @@ import shutil import subprocess import sys +import sysconfig from setuptools import setup from setuptools.command.build_py import build_py from setuptools.command.sdist import sdist @@ -149,5 +150,6 @@ def run(self): setup( cmdclass={'build_py': CustomBuild, 'sdist': CustomSDist}, has_ext_modules=lambda: True, # It's not a Pure Python wheel, - options={"bdist_wheel": {"py_limited_api": "cp37"}}, # to have ABI3 tagged wheel + # Build ABI3 tagged wheel only if interpreter is not free-threaded + options={"bdist_wheel": {"py_limited_api": False if bool(sysconfig.get_config_var("Py_GIL_DISABLED")) else "cp37"}}, )