Skip to content

In-place array repetition changes values without updating serialized TOML #646

Open

Description

@harbinresearcher

On current master (858186a), in-place array repetition changes the Python list but leaves the serialized TOML unchanged:

import tomlkit

doc = tomlkit.parse("a = [1, 2]\n")
a = doc["a"]
a *= 0
assert a == []
print(tomlkit.dumps(doc))  # still a = [1, 2]

With a *= 2, the values become [1, 2, 1, 2], but the document still serializes [1, 2]. Negative repetition similarly clears the list without clearing the rendered values. The array remains the same object attached to the document.

I plan to synchronize this existing list operation by using the array's current clear() / extend() paths, with tests that compare values, serialization and subsequent mutation. This does not change sorting/reordering behavior discussed in #233.

Prepared with AI assistance. I found no repetition-related issue or PR; please flag any overlapping work.

Activity

  1. harbinresearcher commented on Oct 12, 2026

    @harbinresearcher
    Author

    I am working on the narrow synchronization fix and regression tests with AI assistance. The changes will reuse existing array mutation paths and preserve the original array identity; no sorting or slice-assignment behavior changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions