classification
Title: configparser DEFAULT
Type: Stage:
Components: Extension Modules Versions: Python 2.5.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: loewis, quentin.gallet-gilles, shawn.ashlee
Priority: normal Keywords:

Created on 2008-12-12 20:09 by shawn.ashlee, last changed 2008-12-14 19:37 by loewis. This issue is now closed.

Messages (3)
msg77686 - (view) Author: Shawn Ashlee (shawn.ashlee) Date: 2008-12-12 20:09
using .add_section() and .set() for the DEFAULT section adds it twice:

[user@srv ~]$ cat test_configparser.py 
#!/usr/bin/env python

import ConfigParser

a = ConfigParser.SafeConfigParser()

# borked
a.add_section('DEFAULT')
a.set('DEFAULT', 'foo', 'bar')

# working
a.add_section('working')
a.set('working', 'foo', 'bar')

b = open('testing', 'w')
a.write(b)
b.close()

[user@srv ~]$ python test_configparser.py 
[user@srv ~]$ cat testing 
[DEFAULT]
foo = bar

[DEFAULT]

[working]
foo = bar


Tested with 2.4 and 2.5, py3k no longer allows DEFAULT to be passed, so
this is a python < 3k issue.
msg77702 - (view) Author: Quentin Gallet-Gilles (quentin.gallet-gilles) Date: 2008-12-13 00:21
This is already fixed in 2.6 since r60976, the related issue is #1781
I'm not sure this is a good candidate for 2.4.6 and 2.5.3 : this isn't a
security fix, but I doubt fixing this would break existing code as I
can't imagine people relying on this behavior.

Adding Martin to the nosy list so he can pronounce.
msg77817 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2008-12-14 19:37
The release candidate for 2.5.3 has been made; this patch cannot be
considered anymore.

Closing as fixed.
History
Date User Action Args
2008-12-14 19:37:44loewissetstatus: open -> closed
resolution: fixed
messages: + msg77817
2008-12-14 09:44:53quentin.gallet-gillessetversions: + Python 2.5.3, - Python 2.5, Python 2.4
2008-12-13 00:21:20quentin.gallet-gillessetnosy: + loewis, quentin.gallet-gilles
messages: + msg77702
2008-12-12 20:09:15shawn.ashleecreate