Skip to content

fix: tuple_the_args binds to its own signature; all_pk_signature keeps a forced keyword-only; replace_kwargs_using drops a source *args - #96

Merged
thorwhalen merged 1 commit into
masterfrom
fix-variadics-all-pk
Sep 26, 2026
Merged

thorwhalen merged 1 commit into
masterfrom
fix-variadics-all-pk

Conversation

@thorwhalen

Copy link
Copy Markdown
Member

Resolves the two design questions left open by #92, decided with a use-site inventory across i2's 102 local dependents and an independent adversarial review. The decisions, options and evidence are on the issues: #78 and #93.

Changes (all in i2/signatures.py)

Behaviour changes, deliberate, for direct tuple_the_args users only: an unknown keyword for a function without **kwargs now raises instead of being silently dropped; a by-name kwargs={...} dict is spread instead of silently dropped.

Tests

Closes #78
Closes #93

https://claude.ai/code/session_01MCpYkDGuVEygBHheTCcURV

…only in all_pk_signature; drop a source *args in replace_kwargs_using

- ch_variadics_to_non_variadic_kind (tuple_the_args): the wrapper now binds the
  call to the signature it advertises (Sig.map_arguments) and rebuilds the call
  to the original function with _args_and_kwargs_from_all_pk_arguments. The
  tupled param can be given by keyword, defaults skipped before it are filled,
  and the variadic keyword can be given by name as a dict. Calls the advertised
  signature rejects raise FuncCallNotMatchingSignature instead of being
  silently dropped or mangled. Removes the dead try/except on the signature.
- all_pk_signature: a required keyword-only param after a param with a default
  stays keyword-only, and so does everything after it, instead of raising.
  ch_func_to_all_pk therefore handles `def h(x, *y, z)` -> `(x, y=(), *, z)`.
- replace_kwargs_using: a source VAR_POSITIONAL is no longer injected as a
  required keyword-only param the target could never forward.

Closes #78
Closes #93
@thorwhalen
thorwhalen merged commit aa07d6e into master Sep 26, 2026
12 checks passed
@thorwhalen
thorwhalen deleted the fix-variadics-all-pk branch September 26, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant