Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't build with limited API for 3.13 free-threaded build #2402

Merged
merged 2 commits into from
May 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
been reused. This makes `process_iter()`_ around 20x times faster.
- 2396_: a new ``psutil.process_iter.cache_clear()`` API can be used the clear
`process_iter()`_ internal cache.
- 2401_, Support building with free-threaded CPython 3.13.
- 2407_: `Process.connections()`_ was renamed to `Process.net_connections()`_.
The old name is still available, but it's deprecated (triggers a
``DeprecationWarning``) and will be removed in the future.
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