Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ doc = [
ssl = []
certs = []
core = [
"packaging>=24.2",
"packaging @ git+https://github.com/ngoldbaum/packaging@abi3.abi3t",
"more_itertools>=8.8",
"jaraco.text>=3.7",
"importlib_metadata>=6; python_version < '3.10'",
Expand Down
36 changes: 25 additions & 11 deletions setuptools/command/bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,11 @@ def _validate_py_limited_api(self) -> None:
if not re.match(PY_LIMITED_API_PATTERN, self.py_limited_api):
raise ValueError(f"py-limited-api must match '{PY_LIMITED_API_PATTERN}'")

if sysconfig.get_config_var("Py_GIL_DISABLED"):
if sysconfig.get_config_var("Py_GIL_DISABLED") and sys.version_info < (3, 15):
raise ValueError(
f"`py_limited_api={self.py_limited_api!r}` not supported. "
"`Py_LIMITED_API` is currently incompatible with "
"`Py_GIL_DISABLED`. "
"`Py_LIMITED_API` is incompatible with `Py_GIL_DISABLED` "
"on Python 3.14 and older. "
"See https://github.com/python/cpython/issues/111506."
)

Expand All @@ -300,6 +300,21 @@ def wheel_dist_name(self) -> str:
components.append(self.build_number)
return "-".join(components)

@property
def abi_tag(self) -> str:
impl_name = tags.interpreter_name()
impl_ver = tags.interpreter_version()
impl = impl_name + impl_ver
# We don't work on CPython 3.1, 3.0.
if self.py_limited_api and impl.startswith("cp3"):
if sysconfig.get_config_var("Py_GIL_DISABLED"):
abi_tag = "abi3.abi3t"
else:
abi_tag = "abi3"
else:
abi_tag = str(get_abi_tag()).lower()
return abi_tag

def get_tag(self) -> tuple[str, str, str]:
# bdist sets self.plat_name if unset, we should only use it for purepy
# wheels if the user supplied it.
Expand Down Expand Up @@ -342,20 +357,19 @@ def get_tag(self) -> tuple[str, str, str]:
impl_name = tags.interpreter_name()
impl_ver = tags.interpreter_version()
impl = impl_name + impl_ver
# We don't work on CPython 3.1, 3.0.
if self.py_limited_api and (impl_name + impl_ver).startswith("cp3"):
abi_tag = self.abi_tag
if "abi3" in abi_tag:
assert self.py_limited_api is not False
impl = self.py_limited_api
abi_tag = "abi3"
else:
abi_tag = str(get_abi_tag()).lower()
tag = (impl, abi_tag, plat_name)
# issue gh-374: allow overriding plat_name
supported_tags = [
(t.interpreter, t.abi, plat_name) for t in tags.sys_tags()
]
assert tag in supported_tags, (
f"would build wheel with unsupported tag {tag}"
)
assert any(
(t.interpreter, t.abi, plat_name) in supported_tags
for t in tags.parse_tag("-".join(tag))
), f"would build wheel with unsupported tag {tag}"
return tag

def run(self):
Expand Down
Loading