Skip to content

Commit 5ca08c3

Browse files
committed
attempt at free-threaded support
1 parent c42980a commit 5ca08c3

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 3 deletions
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'
@@ -65,14 +65,18 @@ jobs:
6565
strategy:
6666
matrix:
6767
os: [ubuntu-latest, macos-latest, windows-latest]
68+
python-version: [
69+
["3.x", "cp38-* pp*-*"],
70+
["3.14t", "cp314t-*"],
71+
]
6872

6973
steps:
7074
- uses: actions/checkout@v5
7175
with:
7276
submodules: recursive
7377
- uses: actions/setup-python@v6
7478
with:
75-
python-version: 3.x
79+
python-version: ${{ matrix.python-version[0] }}
7680
- name: Install cibuildwheel
7781
run: python -m pip install cibuildwheel
7882
# - name: Install Visual C++ for Python 2.7
@@ -87,7 +91,7 @@ jobs:
8791
- name: Build wheels
8892
run: python -m cibuildwheel --output-dir wheelhouse
8993
env:
90-
CIBW_BUILD: cp38-* pp*-*
94+
CIBW_BUILD: ${{ matrix.python-version[1] }}
9195
CIBW_SKIP: "*musllinux*"
9296
CIBW_ENABLE: pypy
9397
CIBW_ARCHS_LINUX: auto aarch64

setup.py

Lines changed: 8 additions & 5 deletions
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

@@ -74,11 +75,13 @@ def run(self):
7475
except ImportError:
7576
pass
7677
else:
77-
class BDistWheel(wheel.bdist_wheel.bdist_wheel):
78-
def finalize_options(self):
79-
self.py_limited_api = "cp3{}".format(sys.version_info[1])
80-
wheel.bdist_wheel.bdist_wheel.finalize_options(self)
81-
cmdclass['bdist_wheel'] = BDistWheel
78+
# the limited API is only supported on GIL builds as of Python 3.14
79+
if not bool(sysconfig.get_config_var("Py_GIL_DISABLED")):
80+
class BDistWheel(wheel.bdist_wheel.bdist_wheel):
81+
def finalize_options(self):
82+
self.py_limited_api = "cp3{}".format(sys.version_info[1])
83+
wheel.bdist_wheel.bdist_wheel.finalize_options(self)
84+
cmdclass['bdist_wheel'] = BDistWheel
8285

8386
setup(
8487
name="brotlicffi",

0 commit comments

Comments
 (0)