Drop subint-family gate from `main_thread_forkserver`
`main_thread_forkserver` doesn't actually need py3.14 `concurrent.interpreters` (PEP 734) — it forks from a non-trio worker thread and runs `_trio_main` in the child, same shape as `trio_proc`. The previous `_has_subints` gate + subint-family `case` arm were a copy-paste error. In `tractor.spawn._main_thread_forkserver`, - drop the `_has_subints` import + the `RuntimeError` raise in `main_thread_forkserver_proc()`. - drop the now-unused `import sys` (only used by the prior error msg). In `tractor.spawn._spawn.try_set_start_method()`, - pull `'main_thread_forkserver'` out of the subint- family arm (which still gates on `_has_subints`). - merge it into the `'trio'` arm — both set `_ctx = None` bc neither needs an `mp.context`. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-codesubint_forkserver_backend
parent
b7115fc875
commit
fc5e80fea5
|
|
@ -346,7 +346,6 @@ from __future__ import annotations
|
||||||
import errno
|
import errno
|
||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
import sys
|
|
||||||
import threading
|
import threading
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from typing import (
|
from typing import (
|
||||||
|
|
@ -370,7 +369,6 @@ from ._spawn import (
|
||||||
cancel_on_completion,
|
cancel_on_completion,
|
||||||
soft_kill,
|
soft_kill,
|
||||||
)
|
)
|
||||||
from ._subint import _has_subints
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from tractor.discovery._addr import UnwrappedAddress
|
from tractor.discovery._addr import UnwrappedAddress
|
||||||
|
|
@ -832,13 +830,6 @@ async def main_thread_forkserver_proc(
|
||||||
thread instead of `trio.lowlevel.open_process()`.
|
thread instead of `trio.lowlevel.open_process()`.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
if not _has_subints:
|
|
||||||
raise RuntimeError(
|
|
||||||
f'The {"main_thread_forkserver"!r} spawn backend '
|
|
||||||
f'requires Python 3.14+.\n'
|
|
||||||
f'Current runtime: {sys.version}'
|
|
||||||
)
|
|
||||||
|
|
||||||
# Backend-scoped config pulled from `proc_kwargs`. Using
|
# Backend-scoped config pulled from `proc_kwargs`. Using
|
||||||
# `proc_kwargs` (vs a first-class kwarg on this function)
|
# `proc_kwargs` (vs a first-class kwarg on this function)
|
||||||
# matches how other backends expose per-spawn tuning
|
# matches how other backends expose per-spawn tuning
|
||||||
|
|
|
||||||
|
|
@ -135,13 +135,15 @@ def try_set_start_method(
|
||||||
case 'mp_spawn':
|
case 'mp_spawn':
|
||||||
_ctx = mp.get_context('spawn')
|
_ctx = mp.get_context('spawn')
|
||||||
|
|
||||||
case 'trio':
|
case (
|
||||||
|
'trio'
|
||||||
|
| 'main_thread_forkserver'
|
||||||
|
):
|
||||||
_ctx = None
|
_ctx = None
|
||||||
|
|
||||||
case (
|
case (
|
||||||
'subint'
|
'subint'
|
||||||
| 'subint_fork'
|
| 'subint_fork'
|
||||||
| 'main_thread_forkserver'
|
|
||||||
| 'subint_forkserver'
|
| 'subint_forkserver'
|
||||||
):
|
):
|
||||||
# All subint-family backends need no `mp.context`;
|
# All subint-family backends need no `mp.context`;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue