Skip to content

reject array-of-tables header missing its second closing bracket#519

Open
netliomax25-code wants to merge 1 commit into
python-poetry:masterfrom
netliomax25-code:reject-aot-header-missing-bracket
Open

reject array-of-tables header missing its second closing bracket#519
netliomax25-code wants to merge 1 commit into
python-poetry:masterfrom
netliomax25-code:reject-aot-header-missing-bracket

Conversation

@netliomax25-code

Copy link
Copy Markdown
Contributor

Summary

When a table header is opened with [[ for an array of tables, _parse_table skips the first closing bracket after checking it is ], but then consumes a second character as the matching close bracket without verifying it, behind a leftover # TODO: Verify close bracket. A header opened with [[ and closed with a single ] (or with trailing junk after one ], or that hits EOF) is silently accepted: inputs like [[a]b, [[a], [[a.b]x and [[a]x parse as [[a]], and round-tripping rewrites the malformed header to the valid form, so an out-of-spec document is accepted and its text changed under you. tomllib and the toml-test suite reject all of these. The fix mirrors the existing single-bracket check: confirm the second character is ] (raising UnexpectedCharError, or UnexpectedEofError at end of input) before consuming it. Added regression tests for the missing-bracket forms.

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