Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replacing or inserting a slice of an array of tables currently converts the entire replacement list to an ordinary
Array, turning replacement dictionaries andTableobjects into inline tables. Replacing the first table withdoc["a"][:1] = [{"x": 3}]can therefore renderx = 3[[a]]without a newline, producing invalid TOML.Assignments also update only the AoT's
_body, leaving its inherited list storage stale. List equality and JSON serialization consequently return old values; after a length-changing slice assignment, a later deletion can raiseIndexError.Convert each slice replacement independently using the AoT as its parent, then update both representations with the converted value. Integer assignment uses the same storage synchronization. Python's slice insertion, deletion, and extended-slice length checks remain intact.
The 12 regression cases cover dictionaries, existing tables, insertion, negative bounds, positive and negative extended slices, empty replacement, mismatched extended lengths without mutation, integer replacement, and deletion after insertion. They check TOML round trips, list equality, and JSON serialization. On unchanged upstream source, 10 fail and 2 pass; all 12 pass with the fix.
Validation on Python 3.10, 3.13, and 3.14 / Windows:
toml-testsubmodule: 1,080 passed on each version.tests/toml-test/gen.py); no new errors.Agent Drafting Metadata