Skip to content

raise on malformed array element instead of dropping it#527

Open
netliomax25-code wants to merge 1 commit into
python-poetry:masterfrom
netliomax25-code:reject-malformed-array-element
Open

raise on malformed array element instead of dropping it#527
netliomax25-code wants to merge 1 commit into
python-poetry:masterfrom
netliomax25-code:reject-malformed-array-element

Conversation

@netliomax25-code

Copy link
Copy Markdown
Contributor

Summary

Repro: parse a = [{1] or a = [1, {2], an inline table that never reaches its =.
Cause: _parse_array caught the UnexpectedCharError from the element's _parse_value and dropped it, so the cursor was left sitting on ] and the array came back truncated ([], [1]) rather than failing on the bad element.
Fix: let the element parse error propagate. The existing self._current != "]" guard already handles the empty / trailing-comma case that except was covering, so nothing valid changes.

Adds a regression test in tests/test_parser.py; full suite including the toml-test 1.1 cases stays green.

Agent Drafting Metadata

  • Agent:
  • Model:
  • Notes:

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