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

Support Free Threading in Python 3.13 #608

Open
6 tasks
ronaldoussoren opened this issue May 10, 2024 · 0 comments
Open
6 tasks

Support Free Threading in Python 3.13 #608

ronaldoussoren opened this issue May 10, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@ronaldoussoren
Copy link
Owner

Is your feature request related to a problem? Please describe.
Python 3.13 introduces an (experimental) free threading option (aka "NO_GIL"). PyObjC should support this feature.

Describe the solution you'd like

TL/DR: This is a lot more work than "build extension modules using a free threaded build"

Adding this requires a number of changes to PyObjC and the build process:

  • Migrate all extension modules to 2 phase init
  • Check all framework extension modules for possible threading issues and enable free threading for them
  • Add fine grained locking in pyobjc-core, and then enable free threading
  • Update the testing harness to also test a free threading build for 3.13 (both architectures)
  • [ ]Update the distribution building script to also build free threaded extension modules
  • Add documentation about support for free threading
  • Add test scripts that stress tests the free threading support and run those with TSAN enabled

The hard part is updating pyobjc-core, that code relies on module global state that's protected by the GIL. A somewhat easy option is to switch to a "global pyobjc lock" in the short term and slowly peel of bits that can use more fine grained locking.

@ronaldoussoren ronaldoussoren added the enhancement New feature or request label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant