Skip to content

Fix abi3 suffixes for pre-3.15 wheel targets - #5390

Open
LittleChenLiya wants to merge 2 commits into
pypa:mainfrom
LittleChenLiya:fix/issue-5389-abi3-older-target-suffix
Open

LittleChenLiya wants to merge 2 commits into
pypa:mainfrom
LittleChenLiya:fix/issue-5389-abi3-older-target-suffix

Conversation

@LittleChenLiya

Copy link
Copy Markdown

Summary of changes

Pass the py-limited-api wheel target to build_ext. Wheel targets older than Python 3.15 now receive unqualified stable-ABI extension suffixes that those interpreters can import. Python 3.15+ targets retain platform-qualified suffixes.

Regression coverage checks cp311, cp314, and cp315.

Closes #5389

Pull Request Checklist

  • Changes have tests
  • News fragment added in [newsfragments/].

Pass the wheel's limited-API target to build_ext so older interpreters
receive the unqualified suffix they can import.

@atishay-kasliwal atishay-kasliwal left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Built a py_limited_api=True extension with bdist_wheel --py-limited-api=cp311 on Python 3.15. Master named it spam.abi3-darwin.so, which 3.13 and 3.14 can't import (their EXTENSION_SUFFIXES only have .abi3.so). Here it's spam.abi3.so, and it imports on 3.13, 3.14 and 3.15. For cp315 and up the platform-qualified suffix is kept.

@LittleChenLiya

LittleChenLiya commented Dec 1, 2026 via email

Copy link
Copy Markdown
Author

py_limited_api accepts an interpreter tag such as cp313t, so parsing the
whole suffix as an int raised ValueError. Read the leading version digits
instead so the 3.15 gate also works for free-threaded targets.

Extend the regression to cp313t and cp315t.
@LittleChenLiya

Copy link
Copy Markdown
Author

Thanks again for the 3.13/3.14/3.15 verification, @atishay-kasliwal — the spam.abi3.so result for older targets with spam.abi3-darwin.so retained for cp315+ is the intended split.

I also hardened the new target check in e08357e. py_limited_api can be a free-threaded interpreter tag such as cp313t or cp315t, and parsing the whole suffix as an int raised ValueError for those. The gate now reads the leading version digits, and the regression covers cp311, cp314, cp315, cp313t, and cp315t.

Local validation: test_bdist_wheel.py + test_build_ext.py → 194 passed, 4 skipped; Ruff clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] building on 3.15 for older abi3 interpreters uses incompatible platform-specific suffix

2 participants