Skip to content

Avoid testing iterable truth values in BoxList construction - #336

Open
fhgffy wants to merge 1 commit into
cdgriffith:developfrom
fhgffy:fix/boxlist-iterable-truth-value
Open

fhgffy wants to merge 1 commit into
cdgriffith:developfrom
fhgffy:fix/boxlist-iterable-truth-value

Conversation

@fhgffy

@fhgffy fhgffy commented Oct 9, 2026

Copy link
Copy Markdown

BoxList checks the input's truth value before iterating. A NumPy array with multiple elements therefore raises ValueError, while an iterable with a false truth value silently loses its contents.

Check whether the input is None instead. Add regressions for both kinds of iterable, including conversion of their dictionaries into Boxes. Empty and default inputs keep their existing behavior.

Validation: both new cases fail before the change; all 161 tests pass afterward on Python 3.14. Wheel and sdist builds pass. The modified files have the same eight Ruff diagnostics as the unchanged base, with no new diagnostics. Also checked with NumPy 2.5.3 arrays containing zero, multiple values, and no values.

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