Skip to content

Convert replacement values in BoxList assignments - #331

Open
x0Lazarus wants to merge 1 commit into
cdgriffith:developfrom
x0Lazarus:fix/convert-boxlist-replacements
Open

x0Lazarus wants to merge 1 commit into
cdgriffith:developfrom
x0Lazarus:fix/convert-boxlist-replacements

Conversation

@x0Lazarus

Copy link
Copy Markdown

Replacing a BoxList item with a dictionary stores a plain dict, so attribute access no longer works. For example, after rows[0] = {"label": "updated"}, rows[0].label raises AttributeError. Appending that same dictionary converts it to a Box correctly.

Apply the existing conversion helper to item and slice assignments, including a direct dotted index such as "[0]". Replacements then receive the same nested conversion and options as appended values. The tests also check custom Box classes, intact types, slice iterators, invalid slice lengths, and frozen lists. Invalid slice steps are still rejected before reading replacement values. This addresses the behavior previously described in the closed PR #329.

All 183 tests pass on Windows with Python 3.12, both from Python source and with Cython 3.3.0 extensions compiled and loaded. Twelve of the added cases fail on unchanged develop; the twelve compatibility cases pass there. Black, mypy, the package build and Twine checks pass. Other Python versions, PyPy, Linux and macOS remain untested locally. Includes the changelog and contributor entries requested by the contribution guide, and targets develop.

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