Skip to content

Read update sources without testing their truth value - #367

Open
OnlineBunker wants to merge 5 commits into
cdgriffith:developfrom
OnlineBunker:fix/update-source-truth
Open

OnlineBunker wants to merge 5 commits into
cdgriffith:developfrom
OnlineBunker:fix/update-source-truth

Conversation

@OnlineBunker

Copy link
Copy Markdown

Fixes #366.

Box.update / merge_update and the ConfigBox overrides truth-tested the input before iteration. This rejects valid iterables such as NumPy key/value arrays and silently skips nonempty mappings whose __bool__ returns False.

Use an explicit None check instead. No-argument and None calls keep their existing behavior. Normal insertion rules, nested Box conversion and recursive merging are unchanged. Invalid falsy non-iterables such as 0 now raise TypeError instead of being silently ignored.

Added 30 regression/control cases across both classes and methods, covering iterable/mapping inputs with unavailable truth values, false mappings, empty inputs, None/no arguments and nested merges. 22 fail on unmodified develop. Updated CHANGES.rst and AUTHORS.rst as requested by CONTRIBUTING.

Validation on Linux:

  • Python 3.11, 3.12, 3.13, 3.14 and 3.15: 1,254 passed, 1 skipped on each.
  • Cython-compiled modules, Python 3.13: 1,254 passed, 1 skipped.
  • Full Ruff check, changed-file format check, mypy (9 source files), and git diff --check pass.
  • Manually checked the NumPy reproduction for both methods/classes.
  • Fresh clone of the submitted branch matches all five tested files byte-for-byte; full Python 3.14 suite passed there too.

AI assistance used for investigation, implementation and tests. No Windows execution claim.

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