Skip to content

Commit 4ceccf0

Browse files
authored
[mypyc] Preserve the debug ABI flag in extension suffixes (#22490)
Needed to fix #17819
1 parent 283eb21 commit 4ceccf0

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎mypyc/options.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def __repr__(self) -> str:
9696
def replace_ext_suffix_version(suffix: str, version: tuple[int, int], free_threaded: bool) -> str:
9797
"""Replace the Python version tag in an extension suffix such as ".cp313-win_amd64.pyd"."""
9898
tag = f"{version[0]}{version[1]}{'t' if free_threaded else ''}"
99-
result, n = re.subn(r"(\.cpython-|\.cp)\d+t?(?=-)", rf"\g<1>{tag}", suffix, count=1)
99+
result, n = re.subn(r"(\.cpython-|\.cp)\d+t?(?=d?-)", rf"\g<1>{tag}", suffix, count=1)
100100
if n == 0:
101101
raise ValueError(
102102
f'Can\'t target Python {version[0]}.{version[1]}{"t" if free_threaded else ""}: '

‎mypyc/test/test_target_python.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ def test_ext_suffix(self) -> None:
4040
for host, target, expected in [
4141
(".cpython-313-x86_64-linux-gnu.so", "3.14t", ".cpython-314t-x86_64-linux-gnu.so"),
4242
(".cpython-314t-darwin.so", "3.13", ".cpython-313-darwin.so"),
43+
(".cpython-312d-x86_64-linux-gnu.so", "3.14t", ".cpython-314td-x86_64-linux-gnu.so"),
44+
(".cpython-314td-darwin.so", "3.12", ".cpython-312d-darwin.so"),
4345
(".cp313-win_amd64.pyd", "3.14t", ".cp314t-win_amd64.pyd"),
4446
("_d.cp313t-win_amd64.pyd", "3.12", "_d.cp312-win_amd64.pyd"),
4547
]:

0 commit comments

Comments
 (0)