Skip to content

Commit ac7cb9e

Browse files
zmedicocclauss
andauthored
Support Py_GIL_DISABLED (#206)
* Add free-threaded Python 3.14t to the testing * 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. --------- Co-authored-by: Christian Clauss <cclauss@me.com>
1 parent 8063947 commit ac7cb9e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
os: [ubuntu-latest, macos-latest, windows-latest]
25-
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
25+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"]
2626
steps:
2727
- name: Set git to use LF on Windows
2828
if: runner.os == 'Windows'

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 = "cp{}{}".format(*sys.version_info)
8082
wheel.bdist_wheel.bdist_wheel.finalize_options(self)
8183
cmdclass['bdist_wheel'] = BDistWheel
8284

0 commit comments

Comments
 (0)