Skip to content

Comments not preserved on merge #171

@tkeffer

Description

@tkeffer

Using ConfigObj v5.0.6, consider this:

import sys
from StringIO import StringIO
from configobj import ConfigObj

c = ConfigObj(StringIO("""[Section1]"""))

d = ConfigObj(StringIO("""[Section1]

  # This is a Section2 comment
  [[Section2]]
     option2 = foo
"""))

c.merge(d)

c.write(sys.stdout)

The output is:

[Section1]
[[Section2]]
option2 = foo

while I would have expected

[Section1]
# This is a Section2 comment
[[Section2]]
option2 = foo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions