Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mypyc/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __repr__(self) -> str:
def replace_ext_suffix_version(suffix: str, version: tuple[int, int], free_threaded: bool) -> str:
"""Replace the Python version tag in an extension suffix such as ".cp313-win_amd64.pyd"."""
tag = f"{version[0]}{version[1]}{'t' if free_threaded else ''}"
result, n = re.subn(r"(\.cpython-|\.cp)\d+t?(?=-)", rf"\g<1>{tag}", suffix, count=1)
result, n = re.subn(r"(\.cpython-|\.cp)\d+t?(?=d?-)", rf"\g<1>{tag}", suffix, count=1)
if n == 0:
raise ValueError(
f'Can\'t target Python {version[0]}.{version[1]}{"t" if free_threaded else ""}: '
Expand Down
2 changes: 2 additions & 0 deletions mypyc/test/test_target_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def test_ext_suffix(self) -> None:
for host, target, expected in [
(".cpython-313-x86_64-linux-gnu.so", "3.14t", ".cpython-314t-x86_64-linux-gnu.so"),
(".cpython-314t-darwin.so", "3.13", ".cpython-313-darwin.so"),
(".cpython-312d-x86_64-linux-gnu.so", "3.14t", ".cpython-314td-x86_64-linux-gnu.so"),
(".cpython-314td-darwin.so", "3.12", ".cpython-312d-darwin.so"),
(".cp313-win_amd64.pyd", "3.14t", ".cp314t-win_amd64.pyd"),
("_d.cp313t-win_amd64.pyd", "3.12", "_d.cp312-win_amd64.pyd"),
]:
Expand Down
Loading