Skip to content

TST: fix a small abi3t tag test issue, and add a new test for multiarch filename - #882

Merged
dnicolodi merged 2 commits into
mesonbuild:mainfrom
rgommers:abi3-tests
Aug 24, 2026
Merged

TST: fix a small abi3t tag test issue, and add a new test for multiarch filename#882
dnicolodi merged 2 commits into
mesonbuild:mainfrom
rgommers:abi3-tests

Conversation

@rgommers

Copy link
Copy Markdown
Contributor

This is a follow-up to gh-876. The new multiarch test addresses a gap in test coverage that is important - we've stumbled over this case a few times over the past years.

The assertion parsed as:

    assert (abi == 'abi3.abi3t') if IS_ABI3T else 'abi3'

which will never fail for GIL-enabled builds.
Python 3.15 and later append the multiarch tuple to the stable ABI
filename suffix. The multiarch tuple is not part of the ABI tag and must
be ignored: when cross compiling it is the one of the host platform and
differs from the one of the build interpreter. This test fails without
the regular expression fix in commit 865aa61.
Comment thread tests/test_tags.py
# Python 3.15 and later append the multiarch tuple to the stable ABI
# filename suffix. Verify that it is ignored rather than causing the
# module to be rejected: when cross compiling it differs from the one
# of the build interpreter.

@dnicolodi dnicolodi Aug 24, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I had this kind of issue on my mind when thinking about the support for build-detail.json in #829. We have this check right now

abi3t = bool(sysconfig.get_config_var('Py_GIL_DISABLED')) and sys.version_info >= (3, 15)
expected_abi = 'abi3t' if abi3t else 'abi3'
which makes it impossible to cross-compile between a Python platform that uses abi3t and one that does not.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The regular expression used to extract the ABI from the filename matches both f'extension.{STABLE_ABI_KIND}-aarch64-linux-gnu.so' and f'extension.{STABLE_ABI_KIND}.so' and any other valid extension module filename, and this is verified at runtime. One test more is better than one test less, thus wer should include this one, but I would like to add some proper cross-compilation tests.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would like to add some proper cross-compilation tests.

💯 me too. However, that's for the build-details.json PR or a follow-up to that I think. This test is cheap (just regex/strings, no building), and would have caught an issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

which makes it impossible to cross-compile between a Python platform that uses abi3t and one that does not.

I think we can fix that up by extending support to more combinations once gh-829 is in? In practice there are lots of combinations of build/host-platform that are difficult. The most common one uses the same Python version and just changes the host platform. That's the test case I'd add first. Then extend from there.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This test is cheap (just regex/strings, no building), and would have caught an issue.

Out of curiosity, which issue would this test have caught that other tests did have not?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we can fix that up by extending support to more combinations once gh-829 is in?

Sure. It is just matter to replace checks against the values obtained from the current interpreter with checks against what is in build-details.json. Should we try to get gh-829 in for this release?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My review comment on gh-876: #876 (comment)

Which I think was a recurrence of the thing fixed in gh-322.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should we try to get gh-829 in for this release?

Yes, that'd be great.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we try to get gh-829 in for this release?

Yes, that'd be great.

I can try to find time to finish the PR. However, I would be hesitant to merge it without an integration test. Ideally the test would compiler an extension module, thus it requires a C cross compiler and a build-details.json for the target foreign architecture. What's the easiest way to get these?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can also get the release out, merge it right after, and do another release. To take it off of the critical path (we shouldn't drop it for months though).

However, I would be hesitant to merge it without an integration test. Ideally the test would compiler an extension module, thus it requires a C cross compiler and a build-details.json for the target foreign architecture. What's the easiest way to get these?

Conda/pixi is the easiest way to get a cross compilation toolchain. I already have an integration test for scipy; would need to scope that down to running on a test package (or set of packages) and then adding it in a new CI job.

Let's move the CI coverage part to gh-829 though? I think we can discuss the release plan here; this PR is ready to go, and we can probably push to get 1-2 more PRs in, but then ship 0.21.0

Comment thread tests/test_wheel.py
name = artifact.parsed_filename
assert name.group('pyver') == INTERPRETER
assert name.group('abi') == 'abi3.abi3t' if FREE_THREADED_BUILD else 'abi3'
assert name.group('abi') == ('abi3.abi3t' if FREE_THREADED_BUILD else 'abi3')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ups! Thanks for catching this.

@dnicolodi
dnicolodi merged commit 6b9c6d9 into mesonbuild:main Aug 24, 2026
35 checks passed
@rgommers
rgommers deleted the abi3-tests branch August 25, 2026 04:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants