Skip to content

Accept positional source and keyword overrides in Box.update - #342

Merged
cdgriffith merged 1 commit into
cdgriffith:developfrom
AryanRG:fix/update-source-and-keywords
Nov 4, 2026
Merged

cdgriffith merged 1 commit into
cdgriffith:developfrom
AryanRG:fix/update-source-and-keywords

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Bug

Box.update() rejects a valid positional source together with keyword overrides:

from box import Box

config = Box(timeout=10)
config.update({"timeout": 20}, timeout=30)
assert config.timeout == 30

The current call raises BoxTypeError: update expected at most 1 argument, got 2 because the arity guard counts the keyword argument set as another positional source. This patch counts only positional sources. The existing update loops already apply source values before keyword values, preserving the expected override order. It also adds regressions, an unreleased changelog entry, and contributor credit.

Validation

  • New regression against the base: 4 failed, 3 controls passed in both pure-Python and compiled Cython modes.
  • Patched regression: 7 passed in both modes.
  • Full suite: 166 passed in both pure-Python and compiled Cython modes (base: 159 passed).
  • Black, mypy, and git diff --check: passed.

Validation ran on macOS with Python 3.12.15; the other supported interpreter/platform and wheel matrix remains for CI.

AI assistance was used to prepare the implementation and regression tests.

@cdgriffith
cdgriffith merged commit b2afab7 into cdgriffith:develop Nov 4, 2026
34 checks passed
@cdgriffith cdgriffith mentioned this pull request Nov 4, 2026
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.

2 participants