This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2010年06月02日 21:01 by Edwin.Pozharski, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| unnamed | Edwin.Pozharski, 2010年06月03日 13:37 | |||
| Messages (5) | |||
|---|---|---|---|
| msg106912 - (view) | Author: Edwin Pozharski (Edwin.Pozharski) | Date: 2010年06月02日 21:01 | |
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. |
|||
| msg106913 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2010年06月02日 21:08 | |
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.) |
|||
| msg106918 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2010年06月02日 21:33 | |
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? :) |
|||
| msg106944 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2010年06月03日 11:50 | |
See #8888 |
|||
| msg106950 - (view) | Author: Edwin Pozharski (Edwin.Pozharski) | Date: 2010年06月03日 13:37 | |
Thanks - gotta rtfm :) On Wed, Jun 2, 2010 at 5:33 PM, R. David Murray <report@bugs.python.org>wrote: > > R. David Murray <rdmurray@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 <report@bugs.python.org> > <http://bugs.python.org/issue8880> > _______________________________________ > |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:01 | admin | set | github: 53126 |
| 2010年06月03日 13:37:51 | Edwin.Pozharski | set | files:
+ unnamed messages: + msg106950 |
| 2010年06月03日 11:50:20 | eric.araujo | set | messages: + msg106944 |
| 2010年06月02日 21:33:17 | r.david.murray | set | status: open -> closed nosy: + r.david.murray messages: + msg106918 resolution: wont fix stage: resolved |
| 2010年06月02日 21:08:04 | eric.araujo | set | versions:
+ Python 3.2, - Python 2.6 nosy: + eric.araujo messages: + msg106913 components: + Library (Lib) |
| 2010年06月02日 21:01:36 | Edwin.Pozharski | create | |