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,