Fix typos + typing in `_mp_fixup_main`

- "spawing" → "spawning", close unbalanced
  backtick on `` `start_method='trio'` ``
- "uneeded" → "unneeded", "deats" → "details"
- Remove double `d` annotation; filter
  `get_preparation_data()` result into only
  `ParentMainData` keys before returning
- Use `pop('authkey', None)` for safety

Review: PR #1 (Copilot)
https://github.com/mahmoudhas/tractor/pull/1#pullrequestreview-4091096072

(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
subint_spawner_backend
Gud Boi 2026-04-10 14:53:24 -04:00 committed by mahmoudhas
parent 27bf566d75
commit a0a7668670
1 changed files with 13 additions and 7 deletions

View File

@ -22,9 +22,9 @@ Now just delegates directly to appropriate `mp.spawn` fns.
Note Note
---- ----
These helpers are needed for any spawing backend that doesn't already These helpers are needed for any spawning backend that doesn't already
handle this. For example it's needed when using our handle this. For example it's needed when using our
`start_method='trio' backend but not when we're already using `start_method='trio'` backend but not when we're already using
a ``multiprocessing`` backend such as 'mp_spawn', 'mp_forkserver'. a ``multiprocessing`` backend such as 'mp_spawn', 'mp_forkserver'.
?TODO? ?TODO?
@ -68,12 +68,18 @@ def _mp_figure_out_main(
if not inherit_parent_main: if not inherit_parent_main:
return {} return {}
d: ParentMainData
proc: mp.Process = mp.current_process() proc: mp.Process = mp.current_process()
d: dict = get_preparation_data( prep_data: dict = get_preparation_data(
name=proc.name, name=proc.name,
) )
# XXX, unserializable (and uneeded by us) by default # XXX, unserializable (and unneeded by us) by default
# see `mp.spawn.get_preparation_data()` impl deats. # see `mp.spawn.get_preparation_data()` impl details.
d.pop('authkey') prep_data.pop('authkey', None)
d: ParentMainData = {}
if 'init_main_from_name' in prep_data:
d['init_main_from_name'] = prep_data['init_main_from_name']
if 'init_main_from_path' in prep_data:
d['init_main_from_path'] = prep_data['init_main_from_path']
return d return d