Skip to content

Commit d53b678

Browse files
committed
Only enable multi-phase init on free-threaded builds
1 parent 8f818ca commit d53b678

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mypyc/codegen/emitmodule.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
)
4040
from mypyc.codegen.literals import Literals
4141
from mypyc.common import (
42+
IS_FREE_THREADED,
4243
MODULE_PREFIX,
4344
PREFIX,
4445
RUNTIME_C_FILES,
@@ -514,7 +515,9 @@ def __init__(
514515
self.use_shared_lib = group_name is not None
515516
self.compiler_options = compiler_options
516517
self.multi_file = compiler_options.multi_file
517-
self.multi_phase_init = True
518+
# Multi-phase init is needed to enable free-threading. In the future we'll
519+
# probably want to enable it always, but we'll wait until it's stable.
520+
self.multi_phase_init = IS_FREE_THREADED
518521

519522
@property
520523
def group_suffix(self) -> str:

0 commit comments

Comments
 (0)