Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,9 @@ jobs:
with:
matrix_yaml: |
include:
- { runner: ubuntu-24.04, python-version: 3.14t }
- { runner: macos-26, python-version: 3.14t }
- { runner: windows-2025, python-version: 3.14t }
- { runner: ubuntu-24.04, python-version: 3.15t-dev }
- { runner: macos-26, python-version: 3.15t-dev }
- { runner: windows-2025, python-version: 3.15t-dev }

pytest-run-parallel:
needs: make_run_parallel_matrix
Expand Down Expand Up @@ -536,7 +536,7 @@ jobs:

clang_TSAN:
runs-on: ubuntu-24.04
container: ghcr.io/nascheme/numpy-tsan:3.14t
container: ghcr.io/nascheme/numpy-tsan:3.15t-dev
steps:
- uses: actions/checkout@v4

Expand Down
13 changes: 11 additions & 2 deletions src/cffi/_cffi_include.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,13 @@
#if !defined(_CFFI_USE_EMBEDDING) && !defined(Py_LIMITED_API)
# ifdef _MSC_VER
# if !defined(_DEBUG) && !defined(Py_DEBUG) && !defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) && !defined(_CFFI_NO_LIMITED_API)
# define Py_LIMITED_API
# if !defined(Py_GIL_DISABLED)
# define Py_LIMITED_API
# else
# define Py_LIMITED_API 0x030f0000
# endif
# endif

# include <pyconfig.h>
/* sanity-check: Py_LIMITED_API will cause crashes if any of these
are also defined. Normally, the Python file PC/pyconfig.h does not
Expand All @@ -49,7 +54,11 @@
# else
# include <pyconfig.h>
# if !defined(Py_DEBUG) && !defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) && !defined(_CFFI_NO_LIMITED_API)
# define Py_LIMITED_API
# if !defined(Py_GIL_DISABLED)
# define Py_LIMITED_API
# else
# define Py_LIMITED_API 0x030f0000
# endif
# endif
# endif
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/cffi/recompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

USE_LIMITED_API = ((sys.platform != 'win32' or sys.version_info < (3, 0) or
sys.version_info >= (3, 5)) and
not sysconfig.get_config_var("Py_GIL_DISABLED")) # free-threaded doesn't yet support limited API
(not sysconfig.get_config_var("Py_GIL_DISABLED") or sys.version_info >= (3, 15))) # free-threaded doesn't yet support limited API

class GlobalExpr:
def __init__(self, name, address, type_op, size=0, check_value=0):
Expand Down
10 changes: 6 additions & 4 deletions src/cffi/setuptools_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ def _set_py_limited_api(Extension, kwds):
kwds['py_limited_api'] = True

if sysconfig.get_config_var("Py_GIL_DISABLED"):
if kwds.get('py_limited_api'):
log.info("Ignoring py_limited_api=True for free-threaded build.")

kwds['py_limited_api'] = False
if sys.version_info < (3, 15):
if kwds.get('py_limited_api'):
log.info("Ignoring py_limited_api=True for free-threaded build.")
kwds['py_limited_api'] = False
else:
kwds["define_macros"].append(("Py_TARGET_ABI3T", "0x030f0000"))

if kwds.get('py_limited_api') is False:
# avoid setting Py_LIMITED_API if py_limited_api=False
Expand Down
Loading