[New-bugs-announce] [issue1781] ConfigParser: add_section('DEFAULT') causes duplicate sections.
Tim Lesher
report at bugs.python.org
Thu Jan 10 03:42:50 CET 2008
New submission from Tim Lesher:
ConfigParser doesn't prevent "manually" adding a section named DEFAULT;
however, doing so creates a duplicate, inaccessible [DEFAULT] section in
the config file:
----
>>> import sys, ConfigParser
>>> c = ConfigParser.ConfigParser()
>>> c.add_section('DEFAULT')
>>> c.write(sys.stdout)
[DEFAULT]
>>> c.set('DEFAULT', 'color', 'yellow')
>>> c.write(sys.stdout)
[DEFAULT]
color = yellow
[DEFAULT]
----
It seems that the correct thing to do would be to disallow
add_section('DEFAULT').
----------
components: Library (Lib)
messages: 59652
nosy: tlesher
severity: normal
status: open
title: ConfigParser: add_section('DEFAULT') causes duplicate sections.
type: behavior
versions: Python 2.6
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1781>
__________________________________
More information about the New-bugs-announce
mailing list