Skip to content

list_values causes values with "#" to be misinterpreted #270

Description

@gubenkoved

Here is repro demonstrating the issue:

import configobj

if __name__ == "__main__":
    config = configobj.ConfigObj(
        "config.ini",
        encoding='utf-8',
        list_values=False,
    )

    print('loaded', config)

    if 'foo' not in config:
        config['foo'] = {}

    config['foo']['bar'] = 'hello # world'

    print('before write:', config)

    config.write()
    config.reload()

    print('after reload:', config)

Produces output:

loaded {}
before write: {'foo': {'bar': 'hello # world'}}
after reload: {'foo': {'bar': 'hello'}}

Config written:

[foo]
bar = hello # world

Related: #269.

Activity

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