Skip to content

feat(lower): normalize positional-only and keyword-only parameters (T2-3) - #122

Draft
espetro wants to merge 2 commits into
masterfrom
work/t2-param-forms
Draft

espetro wants to merge 2 commits into
masterfrom
work/t2-param-forms

Conversation

@espetro

@espetro espetro commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Tier-2 signature-shape normalization: def f(a, /, b) and def f(a, *, k, k2=1) now lower instead of fencing with PS1202 at the signature.

  • _signature builds params from posonlyargs + args (defaults still cover the tail) then appends kwonlyargs with kw_defaults; params carry "posonly"/"kwonly" flags. **kwargs stays fenced (T2-4).
  • _fill_args/_fill_varargs enforce CPython binding: positional-only parameters refuse keywords (new PS2003 message), keyword-only parameters refuse positional slots and must be passed by name, otherwise their defaults apply. *args already lowered; f(1, *rest, k=…) now binds k too.

New tests/test_t2_param_forms.py: 6 oracle-diff cases vs CPython (pos-only, kw-only, defaults, mixed, *args + kw-only, method self, /) plus 4 refusal cases.

Pins: test_pyjwt_compat re-pinned 103 → 107 — removing the PS1202 signature fence lets kw-only defs lower further and report deeper, more accurate fences. test_census_self untouched; new census: lines 20424 (+36), modules 27, fences 1024 (+1 in _classes), definitions 733, fencedDefinitions 624.

Link to Devin session: https://app.devin.ai/sessions/38fde61b38b448c4a57571fa3e18ffd4
Open in Devin Desktop: https://app.devin.ai/desktop/session/38fde61b38b448c4a57571fa3e18ffd4?variant=devin
Requested by: @espetro

…2-3)

Slash-positional and star-keyword parameters lower into the named-parameter
machinery instead of fencing at the signature. Binding enforces CPython
rules in _fill_args/_fill_varargs: positional-only parameters refuse
keywords, keyword-only parameters refuse positional slots and must be
passed by name. **kwargs capture stays fenced (T2-4).
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying pyscriptc with  Cloudflare Pages  Cloudflare Pages

Latest commit: 54db3bf
Status: ✅  Deploy successful!
Preview URL: https://926b236c.pyscriptc.pages.dev
Branch Preview URL: https://work-t2-param-forms.pyscriptc.pages.dev

View logs

@espetro
espetro force-pushed the work/t2-param-forms branch from 54db3bf to c71cce0 Compare October 21, 2026 13:55

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant