From a0a766867011edea5b86077c292d97d26d3b5edb Mon Sep 17 00:00:00 2001 From: goodboy Date: Fri, 10 Apr 2026 14:53:24 -0400 Subject: [PATCH] Fix typos + typing in `_mp_fixup_main` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - "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 --- tractor/spawn/_mp_fixup_main.py | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tractor/spawn/_mp_fixup_main.py b/tractor/spawn/_mp_fixup_main.py index d1e2c79e..2bd19d1b 100644 --- a/tractor/spawn/_mp_fixup_main.py +++ b/tractor/spawn/_mp_fixup_main.py @@ -22,9 +22,9 @@ Now just delegates directly to appropriate `mp.spawn` fns. 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 -`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'. ?TODO? @@ -68,12 +68,18 @@ def _mp_figure_out_main( if not inherit_parent_main: return {} - d: ParentMainData proc: mp.Process = mp.current_process() - d: dict = get_preparation_data( + prep_data: dict = get_preparation_data( name=proc.name, ) - # XXX, unserializable (and uneeded by us) by default - # see `mp.spawn.get_preparation_data()` impl deats. - d.pop('authkey') + # XXX, unserializable (and unneeded by us) by default + # see `mp.spawn.get_preparation_data()` impl details. + 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