Skip to content

Support for building python-tcod with Python 3.13 --disable-gil (no-GIL) buildΒ #161

Open
@coldwarrl

Description

@coldwarrl

Hi there πŸ‘‹

First off, thank you for maintaining python-tcod β€” it's a really valuable library for roguelike development!

I've been experimenting with Python 3.13's new --disable-gil feature (based on the free-threaded no-GIL branch), and I wanted to see how well python-tcod builds and works in that environment.

πŸ›  What I tried:

  • Cloned the repository and initialized submodules.

  • Patched build_libtcod.py to conditionally skip Py_LIMITED_API when Py_GIL_DISABLED is detected via sysconfig.get_config_var("Py_GIL_DISABLED").

  • Removed py-limited-api entries from pyproject.toml.

  • Attempted to install in editable mode with:

    pip install -e .

⚠️ What fails:

The build still fails due to low-level C header issues during the CFFI extension build:

error: "The limited API is not currently supported in the free-threaded build"
error: unknown type name 'PyMutex'
error: call to undeclared function '_Py_atomic_*'

🧠 My understanding:

It seems that, despite disabling Py_LIMITED_API, some core Python headers or assumptions in libtcod or tcod._libtcod still expect GIL-based behavior and are not currently compatible with the free-threaded interpreter.


πŸ€› Feature Request:

Would it be possible to support building python-tcod on GIL-disabled Python versions in the future?

Even limited or experimental support (e.g. via conditional compilation) would be amazing for those of us exploring Python's no-GIL future.

But I cannot judge the effort.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions