Skip to content

Keep TOML array storage synchronized during in-place repetition - #643

Closed
xiehuanyi wants to merge 1 commit into
python-poetry:masterfrom
xiehuanyi:fix-array-inplace-repeat-20261010-round3
Closed

xiehuanyi wants to merge 1 commit into
python-poetry:masterfrom
xiehuanyi:fix-array-inplace-repeat-20261010-round3

Conversation

@xiehuanyi

Copy link
Copy Markdown

Summary

In-place list repetition bypasses the storage used to render Array and AoT values. For example, a *= 2 changes an array's list contents, but doc.as_string() still writes the original elements; a *= 0 also leaves the old values in the serialized document. Arrays of tables similarly retain their original body.

Implement in-place repetition through the existing mutable-sequence operations so the list, rendered items, and table body stay synchronized. Preserve the object identity, support integer-index objects, and clear values for nonpositive factors. Add round-trip regressions for single-line/multiline arrays, arrays of tables, and subsequent edits.

Validation on Linux/Python 3.12: 12 cases fail before the fix; all 1,116 tests pass after the fix, including the pinned TOML compliance corpus. Repository-pinned Ruff 0.16.10 lint/format and git diff --check pass. Mypy 1.19.1 passes for the changed files. The optional whole-project mypy run reports the same five existing errors on an isolated unmodified checkout; it is not a repository CI step.

Agent Drafting Metadata

  • Agent: OpenAI Codex
  • Model: GPT-6.1-sol, xhigh
  • Notes: The reproduction, regressions, complete test suite, formatting/lint, and baseline comparison were run locally. Other platforms and the downstream Poetry integration matrix were not run locally.

Copilot AI balanced review requested due to automatic review settings October 10, 2026 17:54

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@xiehuanyi xiehuanyi closed this Oct 10, 2026
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.

2 participants