Skip to content

Use a spaced separator when adding to a single-entry inline table - #736

Open
velutinous wants to merge 1 commit into
python-poetry:masterfrom
velutinous:inline-table-setitem-space
Open

velutinous wants to merge 1 commit into
python-poetry:masterfrom
velutinous:inline-table-setitem-space

Conversation

@velutinous

@velutinous velutinous commented Dec 6, 2026 •

Copy link
Copy Markdown

A key added after parsing to an inline table with one entry (or none) was written after a bare ",": setting "c" on a = {b = 1} gave a = {b = 1,c = 2}. Tables with two or more entries already copy the ", " spacing of their explicit separators, but a one-entry table has no separator to copy, and the comma was followed by a space only for tables built in code.

The comma is now followed by a space unless the text after it already starts with whitespace, so a padded table such as { b = 1 } still gets exactly one space. A dict appended to an array goes through the same path and is now written as {name = "John Doe", email = "..."}.

Summary

Fixes #

Duplicate Check

  • I searched the open PRs and found none that already fixes this issue.
  • Related open PRs (if any, and why this PR is still needed):

Agent Drafting Metadata

  • Agent:
  • Model:
  • Notes:

A key added after parsing to an inline table with one entry (or none)
was written after a bare ",": setting "c" on `a = {b = 1}` gave
`a = {b = 1,c = 2}`. Tables with two or more entries already copy the
", " spacing of their explicit separators, but a one-entry table has no
separator to copy, and the comma was followed by a space only for tables
built in code.

The comma is now followed by a space unless the text after it already
starts with whitespace, so a padded table such as `{ b = 1 }` still gets
exactly one space. A dict appended to an array goes through the same
path and is now written as `{name = "John Doe", email = "..."}`.
@human-attestation

human-attestation Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

✅ Human Attestation: @velutinous attested this PR at commit f43ea36 (2026-12-06T16:24:18.035Z).

I have read and understood all agent-written code in this PR. / 我已阅读并理解此 PR 中 Agent 编写的全部代码。

Later pushes to this PR stay attested. Attestation page

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