Skip to content

Commit

Permalink
Don't build with limited API for 3.13 free-threaded build
Browse files Browse the repository at this point in the history
The `--disable-gil` configuration of CPython 3.13 does not currently
support the limited API.
  • Loading branch information
colesbury committed Apr 11, 2024
1 parent 5a3d56b commit 8605e8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

- 2366_, [Windows]: log debug message when using slower process APIs.
- 2375_, [macOS]: provide arm64 wheels. (patch by Matthieu Darbois)
- 2401_, Support building with free-threaded CPython 3.13.

**Bug fixes**

Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import struct
import subprocess
import sys
import sysconfig
import tempfile
import warnings

Expand Down Expand Up @@ -65,6 +66,7 @@
PY37_PLUS = sys.version_info[:2] >= (3, 7)
CP36_PLUS = PY36_PLUS and sys.implementation.name == "cpython"
CP37_PLUS = PY37_PLUS and sys.implementation.name == "cpython"
Py_GIL_DISABLED = sysconfig.get_config_var("Py_GIL_DISABLED")

macros = []
if POSIX:
Expand Down Expand Up @@ -118,10 +120,10 @@ def get_version():

# Py_LIMITED_API lets us create a single wheel which works with multiple
# python versions, including unreleased ones.
if bdist_wheel and CP36_PLUS and (MACOS or LINUX):
if bdist_wheel and CP36_PLUS and (MACOS or LINUX) and not Py_GIL_DISABLED:
py_limited_api = {"py_limited_api": True}
macros.append(('Py_LIMITED_API', '0x03060000'))
elif bdist_wheel and CP37_PLUS and WINDOWS:
elif bdist_wheel and CP37_PLUS and WINDOWS and not Py_GIL_DISABLED:
# PyErr_SetFromWindowsErr / PyErr_SetFromWindowsErrWithFilename are
# part of the stable API/ABI starting with CPython 3.7
py_limited_api = {"py_limited_api": True}
Expand Down

0 comments on commit 8605e8a

Please sign in to comment.