[issue7005] ConfigParser does not handle options without values
Fred L. Drake, Jr.
report at bugs.python.org
Fri Sep 3 05:25:27 CEST 2010
Fred L. Drake, Jr. <fdrake at acm.org> added the comment:
I've attached a diagnostic script that I ran with Python 2.4..3.2 (current py3k HEAD); there are two output variants:
"old style":
[section]
option = None
"new style":
[section]
option
This is the output I get when running this script for each of those Python versions:
2.4.6 RawConfigParser: old-style output
2.4.6 SafeConfigParser: raised TypeError on set
2.4.6 ConfigParser: old-style output
2.5.5 RawConfigParser: old-style output
2.5.5 SafeConfigParser: raised TypeError on set
2.5.5 ConfigParser: old-style output
2.6.5 RawConfigParser: old-style output
2.6.5 SafeConfigParser: raised TypeError on set
2.6.5 ConfigParser: old-style output
2.7 RawConfigParser: new-style output
2.7 SafeConfigParser: raised TypeError on set
2.7 ConfigParser: new-style output
3.1.1 RawConfigParser: old-style output
3.1.1 SafeConfigParser: raised TypeError on set
3.1.1 ConfigParser: old-style output
3.2a1+ RawConfigParser: new-style output
3.2a1+ SafeConfigParser: raised TypeError on set
3.2a1+ ConfigParser: new-style output
Essentially: For the RawConfigParser and ConfigParser classes, the output changes in 2.7 and 3.2, and in a way that should be considered incorrect because it conflicts with the allow_no_values setting.
This is a bug and should be fixed in both 2.7 and 3.2.
The TypeError-on-set is consistently raised only for SafeConfigParser, and should remain unchanged. (Why this was handled differently for SafeConfigParser I don't recall offhand.)
----------
Added file: http://bugs.python.org/file18717/cpsample.py
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7005>
_______________________________________
More information about the Python-bugs-list
mailing list