[issue25723] ConfigParser should never write broken configurations

STINNER Victor report at bugs.python.org
Wed Nov 25 02:57:38 EST 2015


STINNER Victor added the comment:

Terry: "Since anything else without ']' is valid (...)"

A Python script can be used to generate a configuration read by another application. This application can more more strict on the configuration format than Python, so I would prefer to deny '\n', '[' and ']' characters in section names.

I'm not sure that it's ok to modify Python < 3.6 since it can break applications relying on this ugly "feature". I propose to only modify Python 3.6.

If you need strict ConfigParser, you can inherit from the class to override add_section() to add checks on the section name.

@SpaceOne: Are you interested to work on a patch?

----------
nosy: +haypo
versions:  -Python 2.7, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25723>
_______________________________________


More information about the Python-bugs-list mailing list