[ python-Bugs-974019 ] ConfigParser defaults not handled correctly

SourceForge.net noreply at sourceforge.net
Wed Jun 16 12:36:17 EDT 2004


Bugs item #974019, was opened at 2004-06-16 10:36
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=974019&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Charles (melicertes)
Assigned to: Nobody/Anonymous (nobody)
Summary: ConfigParser defaults not handled correctly

Initial Comment:
ConfigParser.getboolean() fails if it falls back to a
default value, and the value passed in was a boolean
object (instead of a string) because it unconditionally
does v.lower().
This should be fixed; there's something un-Pythonic
about expecting a boolean value but not being able to
actually provide a boolean as the default.

I've attached a patch (against 2.3.4c1; should apply to
2.3.4, I think) which makes the v.lower() conditional
on v being a string, and adds bool(True), bool(False),
int(1), and int(0) to _boolean_states.

Alternative resolution:  change the documentation to
specify that /only/ strings should be passed in the
defaults dictionary.  Less Pythonic.



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=974019&group_id=5470



More information about the Python-bugs-list mailing list