Skip to content

Commit 15e5212

Browse files
committed
fixup! fixup! fixup! fixup! fixup! Build free-threaded CPython wheels
1 parent 725e63c commit 15e5212

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

build_libtcod.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
if TYPE_CHECKING:
3030
from collections.abc import Iterable, Iterator
3131

32-
Py_LIMITED_API = 0x03100000
32+
Py_LIMITED_API: None | int = 0x03100000
3333

3434
HEADER_PARSE_PATHS = ("tcod/", "libtcod/src/libtcod/")
3535
HEADER_PARSE_EXCLUDES = ("gl2_ext_.h", "renderer_gl_internal.h", "event.h")
@@ -167,9 +167,14 @@ def walk_sources(directory: str) -> Iterator[str]:
167167
library_dirs: list[str] = [*build_sdl.library_dirs]
168168
define_macros: list[tuple[str, Any]] = []
169169

170-
if "PYODIDE" not in os.environ:
170+
if "free-threading build" in sys.version:
171+
Py_LIMITED_API = None
172+
if "PYODIDE" in os.environ:
171173
# Unable to apply Py_LIMITED_API to Pyodide in cffi<=1.17.1
172174
# https://github.com/python-cffi/cffi/issues/179
175+
Py_LIMITED_API = None
176+
177+
if Py_LIMITED_API:
173178
define_macros.append(("Py_LIMITED_API", Py_LIMITED_API))
174179

175180
sources += walk_sources("tcod/")

0 commit comments

Comments
 (0)