[issue8880] ConfigParser.set does not convert non-string values
Éric Araujo mer...@netwok.org added the comment: See # -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8880 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8880] ConfigParser.set does not convert non-string values
Edwin Pozharski pozhar...@gmail.com added the comment: Thanks - gotta rtfm :) On Wed, Jun 2, 2010 at 5:33 PM, R. David Murray rep...@bugs.python.orgwrote: R. David Murray rdmur...@bitdance.com added the comment: Use SafeConfigParser instead, then you can't make the mistake of passing non-strings to set. We really should update the docs so that ConfigParser is doced only in a 'deprecated' section. But that's a different issue. (Care to open it, merwok? :) -- nosy: +r.david.murray resolution: - wont fix stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8880 ___ -- Added file: http://bugs.python.org/file17531/unnamed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8880 ___Thanks - gotta rtfm :)brbrdiv class=gmail_quoteOn Wed, Jun 2, 2010 at 5:33 PM, R. David Murray span dir=ltrlt;a href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/span wrote:brblockquote class=gmail_quote style=margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex; br R. David Murray lt;a href=mailto:rdmur...@bitdance.com;rdmur...@bitdance.com/agt; added the comment:br br Use SafeConfigParser instead, then you can#39;t make the mistake of passing non-strings to set.br br We really should update the docs so that ConfigParser is doced only in a #39;deprecated#39; section. Â But that#39;s a different issue. Â (Care to open it, merwok? :)br br --br nosy: +r.david.murraybr resolution: Â -gt; wont fixbr stage: Â -gt; committed/rejectedbr status: open -gt; closedbr divdiv/divdiv class=h5br ___br Python tracker lt;a href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;br lt;a href=http://bugs.python.org/issue8880; target=_blankhttp://bugs.python.org/issue8880/agt;br ___br /div/div/blockquote/divbr ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8880] ConfigParser.set does not convert non-string values
New submission from Edwin Pozharski pozhar...@gmail.com: set() method of ConfigParser accepts boolean True/False as values at runtime without converting them to strings internally. As a result, getboolean() method reports the following error File /usr/lib/python2.6/ConfigParser.py, line 350, in getboolean if v.lower() not in self._boolean_states: AttributeError: 'bool' object has no attribute 'lower' since it expects get() method to return strings. (Same problem occurs if other types are used, int/float, etc) Altering set() behavior may be not the best thing to do, I'd rather suggest that getboolean() converts the get() output to string. Of course, the way to avoid this problem is always convert values submitted to set() to strings, but it's a hard-to-catch bug. In my case, I was stuck with problematic configuration when assigning values to wx.CheckBox.GetValue(), which returns boolean. -- messages: 106912 nosy: Edwin.Pozharski priority: normal severity: normal status: open title: ConfigParser.set does not convert non-string values type: behavior versions: Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8880 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8880] ConfigParser.set does not convert non-string values
Éric Araujo mer...@netwok.org added the comment: Would that mean that booleans would be converted to strings on set and converted back on get? Seems wasteful. (I’ve changed the version field for this bug. Its meaning is not “versions this applies to” but “versions that will get a fix”, and 3.2 is the only active branch now. Some bugfixes may still go into 2.7.) -- components: +Library (Lib) nosy: +merwok versions: +Python 3.2 -Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8880 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8880] ConfigParser.set does not convert non-string values
R. David Murray rdmur...@bitdance.com added the comment: Use SafeConfigParser instead, then you can't make the mistake of passing non-strings to set. We really should update the docs so that ConfigParser is doced only in a 'deprecated' section. But that's a different issue. (Care to open it, merwok? :) -- nosy: +r.david.murray resolution: - wont fix stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8880 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com