Skip to content

Convert an table to inline table, the comment is preserved unexpectedly #30

Closed
@frostming

Description

Suppose we have following toml:

[site.user]
name = "John"  # Inline comment
age = 28

I want to convert site.user to an inline table:

v = parsed['site']['user']
table = tomlkit.inline_table()
table.update(v)
print(table.as_string())
{age = 21,name = "John"# Inline comment}

What is weird is that even with:

table.update(dict(v))

The bug still exists.

The expected behavior should be dropping all comments of original table.

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