Skip to content

Commit

Permalink
Fix wheel ABI tag for debug Python 3.13 on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
adang1345 authored and abravalheri committed Oct 25, 2024
1 parent 1ca55c9 commit 1155ca8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions newsfragments/4674.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix the ABI tag when building a wheel using the debug build of Python 3.13 on Windows. Previously, the ABI tag was missing the ``"d"`` flag.
3 changes: 3 additions & 0 deletions setuptools/command/bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ def get_abi_tag() -> str | None:
elif soabi and impl == "cp" and soabi.startswith("cp"):
# Windows
abi = soabi.split("-")[0]
if hasattr(sys, "gettotalrefcount"):
# using debug build; append "d" flag
abi += "d"
elif soabi and impl == "pp":
# we want something like pypy36-pp73
abi = "-".join(soabi.split("-")[:2])
Expand Down
6 changes: 6 additions & 0 deletions setuptools/tests/test_bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,12 @@ def test_get_abi_tag_windows(monkeypatch):
monkeypatch.setattr(tags, "interpreter_name", lambda: "cp")
monkeypatch.setattr(sysconfig, "get_config_var", lambda x: "cp313-win_amd64")
assert get_abi_tag() == "cp313"
monkeypatch.setattr(sys, "gettotalrefcount", lambda: 1, False)
assert get_abi_tag() == "cp313d"
monkeypatch.setattr(sysconfig, "get_config_var", lambda x: "cp313t-win_amd64")
assert get_abi_tag() == "cp313td"
monkeypatch.delattr(sys, "gettotalrefcount")
assert get_abi_tag() == "cp313t"


def test_get_abi_tag_pypy_old(monkeypatch):
Expand Down

0 comments on commit 1155ca8

Please sign in to comment.