[issue974019] ConfigParser non-string defaults broken with .getboolean()

Raghuram Devarakonda report at bugs.python.org
Fri Feb 1 17:32:09 CET 2008


Raghuram Devarakonda added the comment:

With the latest python, get() itself fails with boolean value default. I
tried with this script:

-------------
from ConfigParser import ConfigParser
cfg = ConfigParser({'var':True})
cfg.add_section('test_section')
print cfg.getboolean('test_section', 'var')
-------------

and it results in

-------------
Traceback (most recent call last):
  File "t.py", line 4, in <module>
    print cfg.getboolean('test_section', 'var')
  File "/localhome/raghu/localwork/cpython/trunk/Lib/ConfigParser.py",
line 349, in getboolean
    v = self.get(section, option)
  File "/localhome/raghu/localwork/cpython/trunk/Lib/ConfigParser.py",
line 545, in get
    return self._interpolate(section, option, value, d)
  File "/localhome/raghu/localwork/cpython/trunk/Lib/ConfigParser.py",
line 585, in _interpolate
    if "%(" in value:
TypeError: argument of type 'bool' is not iterable
-------------

I doubt if it is worth fixing the OP's issue considering that
_interpolate is assuming the value to be string. Can I close this issue?

----------
components: +Library (Lib) -None
versions: +Python 2.6

____________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue974019>
____________________________________


More information about the Python-bugs-list mailing list