Skip to content

Commit 1155ca8

Browse files
adang1345abravalheri
authored andcommitted
Fix wheel ABI tag for debug Python 3.13 on Windows
1 parent 1ca55c9 commit 1155ca8

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

newsfragments/4674.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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.

setuptools/command/bdist_wheel.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ def get_abi_tag() -> str | None:
129129
elif soabi and impl == "cp" and soabi.startswith("cp"):
130130
# Windows
131131
abi = soabi.split("-")[0]
132+
if hasattr(sys, "gettotalrefcount"):
133+
# using debug build; append "d" flag
134+
abi += "d"
132135
elif soabi and impl == "pp":
133136
# we want something like pypy36-pp73
134137
abi = "-".join(soabi.split("-")[:2])

setuptools/tests/test_bdist_wheel.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,12 @@ def test_get_abi_tag_windows(monkeypatch):
470470
monkeypatch.setattr(tags, "interpreter_name", lambda: "cp")
471471
monkeypatch.setattr(sysconfig, "get_config_var", lambda x: "cp313-win_amd64")
472472
assert get_abi_tag() == "cp313"
473+
monkeypatch.setattr(sys, "gettotalrefcount", lambda: 1, False)
474+
assert get_abi_tag() == "cp313d"
475+
monkeypatch.setattr(sysconfig, "get_config_var", lambda x: "cp313t-win_amd64")
476+
assert get_abi_tag() == "cp313td"
477+
monkeypatch.delattr(sys, "gettotalrefcount")
478+
assert get_abi_tag() == "cp313t"
473479

474480

475481
def test_get_abi_tag_pypy_old(monkeypatch):

0 commit comments

Comments
 (0)