Skip to content

Fix defaulted CatchAll constructor argument ordering - #259

Open
Neallin-917 wants to merge 1 commit into
rnag:mainfrom
Neallin-917:codex/repro-251-catchall-default
Open

Neallin-917 wants to merge 1 commit into
rnag:mainfrom
Neallin-917:codex/repro-251-catchall-default

Conversation

@Neallin-917

Copy link
Copy Markdown

Summary

Fixes #251.

When a CatchAll field with a default factory follows an ordinary defaulted
field, inserting its value into the positional constructor arguments can bind
it to the wrong field. This either raises a duplicate-argument TypeError or,
for empty input, silently replaces the preceding field's default with {}.

Pass defaulted CatchAll fields by keyword, while preserving positional order
for required CatchAll fields. Twelve parametrized cases cover empty/known/extra
input, keyword-only fields, required-field positions, and a CatchAll field
between defaulted fields. This does not change the cache-marker handling
addressed separately by #253.

Validation

  • Full unit suite passes on CPython 3.9–3.14 and PyPy 3.11.
  • Upstream tox environments py39, py310, py311, py312, py313 and py314 pass:
    TZ=UTC tox -e py39,py310,py311,py312,py313,py314 --override 'testenv.pass_env=TZ'.
  • CPython 3.14: 896 passed, 2 skipped, 6 xfailed, 4 xpassed; unchanged main:
    884 passed with the same skip/xfail/xpass counts.
  • UTC is necessary on my local test host for the existing v0 dotenv date test;
    without it, both baseline and patch produce December 18 rather than the
    asserted December 17. Tox needs the explicit pass-through above.
  • New test file passes flake8 and pylint; git diff --check passes.
    Whole-project flake8 has 1782 existing diagnostics on both baseline and patch,
    with no added diagnostic. Whole-project pylint is also not clean; this PR
    does not attempt unrelated lint/complexity cleanup.

AI assistance: OpenAI Codex assisted with implementation, regression tests,
patch review and running validation. No independent human review is claimed.

AI assistance: OpenAI Codex assisted with the implementation, regression tests, and validation.
@Neallin-917

Copy link
Copy Markdown
Author

Could you approve the pending CI run when convenient? This is the narrow CatchAll argument-order fix with regression coverage; local validation and Codex assistance are documented above.

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.

CatchAll + earlier field with a default: TypeError 'got multiple values for argument'

1 participant