Skip to content

Commit b750891

Browse files
committed
Support Py_GIL_DISABLED
Do not set py_limited_api when Py_GIL_DISABLED == 1, since it will be rejected as shown: File "/usr/lib/python3.14t/site-packages/setuptools/_distutils/cmd.py", line 135, in ensure_finalized self.finalize_options() ~~~~~~~~~~~~~~~~~~~~~^^ File "<string>", line 82, in finalize_options File "/usr/lib/python3.14t/site-packages/setuptools/command/bdist_wheel.py", line 250, in finalize_options self._validate_py_limited_api() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "/usr/lib/python3.14t/site-packages/setuptools/command/bdist_wheel.py", line 285, in _validate_py_limited_api raise ValueError( ...<4 lines>... ) ValueError: `py_limited_api='cp314'` not supported. `Py_LIMITED_API` is currently incompatible with `Py_GIL_DISABLED`.See python/cpython#111506.
1 parent 8e27c66 commit b750891

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import re
44
import platform
55
import sys
6+
import sysconfig
67
from setuptools import find_packages, setup
78
from setuptools.command.build_ext import build_ext
89

@@ -76,7 +77,8 @@ def run(self):
7677
else:
7778
class BDistWheel(wheel.bdist_wheel.bdist_wheel):
7879
def finalize_options(self):
79-
self.py_limited_api = "cp3{}".format(sys.version_info[1])
80+
if sysconfig.get_config_var("Py_GIL_DISABLED") != 1:
81+
self.py_limited_api = "cp3{}".format(sys.version_info[1])
8082
wheel.bdist_wheel.bdist_wheel.finalize_options(self)
8183
cmdclass['bdist_wheel'] = BDistWheel
8284

0 commit comments

Comments
 (0)