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

Hard disable Py_LIMITED_API under free-threaded build #125

Merged
merged 1 commit into from
Sep 6, 2024

Conversation

nitzmahone
Copy link
Member

@nitzmahone nitzmahone commented Sep 6, 2024

  • Py_LIMITED_API is not currently supported on the t ABI- it will build successfully, but segfaults. Hard disable for free-threaded Pythons until it's working.
  • full test suite passes under free-threaded Linux x86_64 as of 3.13.0rc2
  • update some broken test assumptions around limited API support and eager global GC
  • add non-artifact CI job for 3.13t

fixes #40
fixes #104

NB: CI will fail on the new 3.13t job until 3.13.0rc2 is available in manylinux and cibuildwheel updates to include it. 3.13.0rc2 includes a fix for embedded interpreter init from non-main threads, which causes several of the embedding tests to fail.
(or not, since the Pythons in manylinux images purposely omit libpython, so all the embedding tests are currently being skipped in CI anyway 🙄)

@nitzmahone nitzmahone added this to the 1.18 milestone Sep 6, 2024
* all Linux x86_64 tests pass on 3.13t_x86_64 as of 3.13.0rc2
* update some broken test assumptions around limited API support and eager global GC
* add non-artifact CI job for 3.13t
@arigo
Copy link
Contributor

arigo commented Sep 6, 2024

Sorry, you're on your own here. I don't have time for a proper in-depth review, and I don't want to do a half-serious one.

@nitzmahone nitzmahone requested review from mattclay and removed request for arigo September 6, 2024 07:38
@nitzmahone
Copy link
Member Author

@arigo No worries- I'll have @mattclay review before I merge (we wrote part of this together this afternoon anyway just messing around).

In general, is there any area or functionality where you definitely would want an opportunity to review changes, or should we just merge stuff once we're happy with it and it's passing tests?

@arigo
Copy link
Contributor

arigo commented Sep 6, 2024

I wish I was still interested in the Python ecosystem enough for the free-threading challenge, but it's just not the case. But feel free to ask and tentatively assign me for reviews on other topics, of course! But as far as I can see, most of the rest that needs to be done is just tweaks for the new version of CPython/setuptools/gcc/whatever.

@mattclay
Copy link
Member

mattclay commented Sep 6, 2024

It's worth mentioning that supporting free-threaded builds does not automatically mean running without the GIL. An extension must also opt-in to running without the GIL [1]. Otherwise the GIL is automatically enabled at runtime when the extension is loaded and a warning is issued:

The global interpreter lock (GIL) has been enabled to load module '_cffi_backend', which has not declared that it can run safely without the GIL. To override this behavior and keep the GIL disabled (at your own risk), run with PYTHON_GIL=0 or -Xgil=0.

[1] https://docs.python.org/3.13/howto/free-threading-extensions.html#single-phase-initialization

@nitzmahone nitzmahone merged commit e317b62 into python-cffi:main Sep 6, 2024
12 checks passed
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.

Support for new cp313t GIL-free ABI variant
3 participants