From d1e22ca897ebe38bfd0a756d861169e297cee8cc Mon Sep 17 00:00:00 2001 From: Lysandros Nikolaou Date: Thu, 23 Jan 2025 13:09:55 +0100 Subject: [PATCH] Only build with Cython alpha on the free-threaded build --- packaging/pep517_backend/_backend.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packaging/pep517_backend/_backend.py b/packaging/pep517_backend/_backend.py index 231f3507..17e69334 100644 --- a/packaging/pep517_backend/_backend.py +++ b/packaging/pep517_backend/_backend.py @@ -4,6 +4,7 @@ from __future__ import annotations import os +import sysconfig import typing as t from contextlib import contextmanager, nullcontext, suppress from functools import partial @@ -371,10 +372,12 @@ def get_requires_for_build_wheel( stacklevel=999, ) - c_ext_build_deps = [] if is_pure_python_build else [ - 'Cython == 3.1.0a1; python_version >= "3.13"', - 'Cython ~= 3.0.0; python_version <= "3.12"', - ] + if is_pure_python_build: + c_ext_build_deps = [] + elif sysconfig.get_config_var("Py_GIL_DISABLED"): + c_ext_build_deps = ['Cython == 3.1.0a1'] + else: + c_ext_build_deps = ['Cython ~= 3.0.0'] return _setuptools_get_requires_for_build_wheel( config_settings=config_settings,