Skip to content

comma is appended to comment when adding to multiline inline tableΒ #512

Closed

Description

@dimbleby
import tomlkit

text = """\
tbl = {
    p = { k = 1 },
    q = { k = 2 }  # comment
}
"""
doc = tomlkit.loads(text)

doc["tbl"]["added"] = 3

output = tomlkit.dumps(doc)
print(output)

result

tbl = {
    p = { k = 1 },
    q = { k = 2 }  # comment,
added = 3}

in which the added comma is part of the comment

Activity

  1. added 3 commits that reference this issue on Jun 13, 2026
    fa68932
    de0cdff
    a0e5a87
  2. added a commit that references this issue on Jun 15, 2026
    281ca00
  3. added a commit that references this issue on Jul 26, 2026
  4. added a commit that references this issue on Oct 17, 2026
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