Skip to content

Build failure on Python 3.14 Free-threaded (cp314t): Py_LIMITED_API is incompatible with Py_GIL_DISABLED #218

@dreampuf

Description

@dreampuf

Description

I am attempting to install brotlicffi using the experimental Python 3.14 Free-threaded build (CPython 3.14t). The build fails during bdist_wheel creation.

The error occurs because brotlicffi is configured to build a Limited API wheel (Stable ABI) in setup.py, but the Limited API is currently explicitly disabled/incompatible with free-threaded (No-GIL) Python builds.

Reproduction Steps

  1. Install Python 3.14 (Free-threaded).
  2. Attempt to pip install brotlicffi.
# Using uv for reproduction
uv python install 3.14
uv run --python 3.14 pip install brotlicffi

Traceback

Traceback (most recent call last):
  ...
  File ".../setuptools/command/bdist_wheel.py", line 285, in _validate_py_limited_api
    raise ValueError(
ValueError: `py_limited_api='cp314'` not supported. `Py_LIMITED_API` is currently incompatible with `Py_GIL_DISABLED`. See https://github.com/python/cpython/issues/111506.

Analysis

The issue stems from setup.py hardcoding the py_limited_api option:

https://github.com/python-hyper/brotlicffi/blob/main/setup.py#L79

self.py_limited_api = "cp3{}".format(sys.version_info[1])

According to the CPython issue #111506, free-threaded builds do not support the stable ABI.

Suggested Fix

I'm not sure whether it's safe to omit the py_limited_api option when running on a free-threaded interpreter. If so, should we remove it from setup.py?

Environment

  • OS: macOS (ARM64)
  • Python: CPython 3.14.0+freethreaded
  • brotlicffi version: 1.1.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions