Skip to content

reject a table redefined after its parent table header#516

Open
netliomax25-code wants to merge 1 commit into
python-poetry:masterfrom
netliomax25-code:reject-redefined-table
Open

reject a table redefined after its parent table header#516
netliomax25-code wants to merge 1 commit into
python-poetry:masterfrom
netliomax25-code:reject-redefined-table

Conversation

@netliomax25-code

Copy link
Copy Markdown
Contributor

Summary

  1. Container.append sends a concrete [table] header that lands inside an existing implicit/super table through _validate_table_candidate, which only flagged a child key on a type change or a dotted-key redefinition.
  2. A child table header that was already defined fell through to a plain merge, so a subtable redefined after its parent received its own header ([a.b] / [a] / [a.b], and the deeper [a.b.c] / [a] / [a.b.c]) was merged silently instead of rejected, while tomllib and the toml-test suite treat these as declaring the same table twice.
  3. _validate_table_candidate now raises when the existing child and the candidate child are both concrete (non-super) tables, and recurses through matching super tables so a duplicate nested deeper is caught as well. Valid out-of-order tables (a new sibling subtable, or extending a table with a deeper header) keep parsing, and the existing tests plus the toml-test 1.0/1.1 suites pass.

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