Skip to content

Fix inline table separator after append#477

Open
cyliu0 wants to merge 2 commits into
python-poetry:masterfrom
cyliu0:fix-inline-table-append-separator
Open

Fix inline table separator after append#477
cyliu0 wants to merge 2 commits into
python-poetry:masterfrom
cyliu0:fix-inline-table-append-separator

Conversation

@cyliu0
Copy link
Copy Markdown

@cyliu0 cyliu0 commented May 18, 2026

Summary

Fix inline table serialization after appending a new key to a parsed inline table that already preserved explicit comma tokens.

The serializer now tracks whether an emitted key still needs a separator. When a later mutation adds a key without an explicit comma token, as_string() inserts the missing comma before rendering the next key.

Fixes #476.

Tests

  • python3 -m pytest tests/test_items.py::test_appending_to_parsed_inline_table_preserves_separator tests/test_items.py::test_deleting_inline_table_element_does_not_leave_trailing_separator tests/test_items.py::test_deleting_inline_table_element_does_not_leave_trailing_separator2 tests/test_items.py::test_items_can_be_appended_to_and_removed_from_an_inline_table -q
  • python3 -m pytest tests -q
  • git diff --check

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.

0.15.0 serializes invalid TOML when appending to a parsed inline table

1 participant