Skip to content

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

@gubenkoved

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions