Skip to content

[mypyc] Enable free threading when compiling multiple modules #19541

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

Merged
merged 15 commits into from
Jul 30, 2025

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Jul 30, 2025

Previously we used multi-phase initialization to enable free threading on Python builds that support it, but only if a single module was compiled in a group.

Implements it also for multiple modules in a group. Add support for multi-phase initialization in module shims and the shared library. It's still only used on free-threaded builds, and we fall back to the old approach on other Python versions/builds.

This enables compiling mypy and mypyc on free-threaded Python builds. At least almost all mypy and mypyc tests now pass when compiled and on 3.14.0b4 with free threading (only tested on macOS so far).

@JukkaL JukkaL merged commit 43364c1 into master Jul 30, 2025
13 checks passed
@JukkaL JukkaL deleted the mypyc-multiphase-init-2 branch July 30, 2025 16:20
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.

2 participants