Found while landing #92 and #93 (adversarial review of the fix-variadics-all-pk branch). Pre-existing, not introduced by either.
ch_func_to_all_pk has two policies for excess keyword arguments, depending on whether the function has *args:
from i2.signatures import ch_func_to_all_pk, tuple_the_args
def f4(a, b=2, **kwargs): return a, b, kwargs
def g(a, *args, **kwargs): return a, args, kwargs
ch_func_to_all_pk(f4)(1, x=3, q=4) # (1, 2, {}) extras DROPPED, though f4 has **kwargs
ch_func_to_all_pk(f4)(1, kwargs={'x': 3}, q=4) # (1, 2, {'x': 3}) q dropped
ch_func_to_all_pk(g)(1, (2,), x=3, q=4) # (1, (2,), {'x': 3, 'q': 4}) extras FORWARDED
tuple_the_args(g)(1, (2,), x=3, q=4) # (1, (2,), {'x': 3, 'q': 4}) forwarded
ch_func_to_all_pk(f4)(1, 2, 3) # TypeError: dict() argument after ** must be a mapping, not int
The no-*args path keeps the 0.1.74 behaviour because meshed's hook_up calls it with a whole scope dict and relies on extras being dropped (#92 pinned that in a test). The *args path (#92) forwards extras. The last line is a sharp edge of the no-*args path: a third positional lands on the kwargs slot.
Both policies live inside ch_func_to_all_pk's wrapper, and the advertised signature would not change, so unifying them is a one-function edit that does not touch meshed / py2http / FlexFuncFanout: route the no-*args path through all_pk_sig.map_arguments(allow_excess=True) + _args_and_kwargs_from_all_pk_arguments against func_sig too, and pick one rule for extras (drop them, or forward them when the function has **kwargs). The decision is which rule; meshed's reliance on "drop" is the constraint.
Found while landing #92 and #93 (adversarial review of the
fix-variadics-all-pkbranch). Pre-existing, not introduced by either.ch_func_to_all_pkhas two policies for excess keyword arguments, depending on whether the function has*args:The no-
*argspath keeps the 0.1.74 behaviour because meshed'shook_upcalls it with a whole scope dict and relies on extras being dropped (#92 pinned that in a test). The*argspath (#92) forwards extras. The last line is a sharp edge of the no-*argspath: a third positional lands on thekwargsslot.Both policies live inside
ch_func_to_all_pk's wrapper, and the advertised signature would not change, so unifying them is a one-function edit that does not touch meshed / py2http /FlexFuncFanout: route the no-*argspath throughall_pk_sig.map_arguments(allow_excess=True)+_args_and_kwargs_from_all_pk_argumentsagainstfunc_sigtoo, and pick one rule for extras (drop them, or forward them when the function has**kwargs). The decision is which rule; meshed's reliance on "drop" is the constraint.