Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: improve support for free-threaded CPython #621

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

rgommers
Copy link
Contributor

As noted in pypa/packaging#727, free-threaded CPython does not support the limited API. Hence raise an exception if a limited-api build is requested.

Also skip/update a few tests that were failing when run under a free-threaded interpreter.

Note that we are already producing the correct wheel tags, since that comes from sysconfig.get_config_var('EXT_SUFFIX').

Addresses part of gh-499. There will be more to do - most importantly adding a CI job. This probably only makes sense to do once the setup-python action adds support (xref actions/setup-python#771). This may happen around the CPython 3.13 beta 1 release (May 7th).

I'll add notes on how to test with a free-threaded build on gh-499 (it's not completely trivial yet).

@rgommers rgommers added the maintenance Regular code improvements that are not new features nor end-user-visible bugs label Apr 17, 2024
Copy link
Member

@dnicolodi dnicolodi left a comment

Choose a reason for hiding this comment

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

Thanks @rgommers for looking into this. This will be important as soon as the first Python 3.13 is out and more people starts testing the nogil interpreter.

mesonpy/__init__.py Outdated Show resolved Hide resolved
mesonpy/__init__.py Outdated Show resolved Hide resolved
tests/test_editable.py Outdated Show resolved Hide resolved
tests/test_wheel.py Outdated Show resolved Hide resolved
@rgommers
Copy link
Contributor Author

Looks like a typo fix in pyproject-metadata 0.8.0 is messing with CI here:

FAILED tests/test_sdist.py::test_pep621 - AssertionError: assert 'Metadata-Ver...1 metadata!\n' == 'Metadata-Ver...1 metadata!\n'
  
  Skipping 116 identical leading characters in diff, use -v to show
  Skipping 906 identical trailing characters in diff, use -v to show
  - ords: full metadata
  ?           ^
  + ords: full,metadata
  ?           ^

gh-613 has a draft fix already, but with more changes. Do you want to finish that PR, or should we fix this typo failure separately first?

@rgommers rgommers force-pushed the support-nogil branch 2 times, most recently from 64bbf42 to ef51f8a Compare April 23, 2024 16:24
@dnicolodi
Copy link
Member

Looks like a typo fix in pyproject-metadata 0.8.0 is messing with CI here:

This should be fixed in main already. I think you just need to rebase on current main.

Copy link
Member

@dnicolodi dnicolodi left a comment

Choose a reason for hiding this comment

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

Looks good to me. Just a couple of minor things.

mesonpy/__init__.py Show resolved Hide resolved
tests/test_editable.py Outdated Show resolved Hide resolved
The free-threaded CPython build does not support the limited API yet,
and won't in the near future. To avoid either cryptic build failures
or a successfull build yielding an `abi3` tag which would not be
correct, raise a clear error and don't attempt to build.
Support for free-threaded CPython in Cython is still a work in progress,
see e.g. cython#6137 - this will land in Cython 3.1.0, and the skipped
test does pass when using Cython built from the branch in cython#6137.
@dnicolodi dnicolodi merged commit 36e6392 into mesonbuild:main Apr 23, 2024
41 checks passed
@rgommers rgommers deleted the support-nogil branch April 24, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Regular code improvements that are not new features nor end-user-visible bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants