Skip to content

Commit a7ac2ce

Browse files
committed
fix: _send_to_invokeid duplicate machine kwarg causing infinite error loop
Same pattern as the _eval_send_params fix: the function received machine as a positional arg AND via **kwargs. Changed to extract machine from kwargs only.
1 parent fbccc5b commit a7ac2ce

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

statemachine/io/scxml/actions.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,9 @@ def _send_to_child(machine: "StateChart", event: str, params_values: dict):
383383
machine.send("error.communication", internal=True)
384384

385385

386-
def _send_to_invokeid(
387-
machine: "StateChart", target: str, event: str, action: SendAction, **kwargs
388-
):
386+
def _send_to_invokeid(target: str, event: str, action: SendAction, **kwargs):
389387
"""Route an event to a specific child by #_<invokeid>."""
388+
machine: "StateChart" = kwargs["machine"]
390389
invokeid = target[2:]
391390
if hasattr(machine, "_engine") and hasattr(machine._engine, "invoke_manager"):
392391
params_values = {}
@@ -443,7 +442,7 @@ def send_action(*args, **kwargs):
443442
return
444443
elif target and target.startswith("#_"):
445444
# Handle #_invokeid target (send to specific child by invoke id)
446-
_send_to_invokeid(machine, target, event, action, **kwargs)
445+
_send_to_invokeid(target, event, action, **kwargs)
447446
return
448447
else:
449448
raise ValueError(f"Invalid target: {target}. Must be one of {_valid_targets}")

0 commit comments

Comments
 (0)