[issue5409] ConfigParser get<int/float/boolean> methods broken
Sylvain Rabot
report at bugs.python.org
Tue Mar 3 06:37:14 CET 2009
New submission from Sylvain Rabot <nihil.is at free.fr>:
Python 3.0 (r30:67507, Dec 3 2008, 20:14:27) [MSC v.1500 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
****************************************************************
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface. This connection is not visible on any external
interface and no data is sent to or received from the Internet.
****************************************************************
IDLE 3.0
>>> from configparser import ConfigParser
>>> config = ConfigParser()
>>> config.add_section("popo")
>>> config.set("popo", "int", 123)
>>> config.getint("popo", "int")
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
config.getint("popo", "int")
File "c:\Python30\lib\configparser.py", line 340, in getint
return self._get(section, int, option)
File "c:\Python30\lib\configparser.py", line 337, in _get
return conv(self.get(section, option))
File "c:\Python30\lib\configparser.py", line 545, in get
return self._interpolate(section, option, value, d)
File "c:\Python30\lib\configparser.py", line 585, in _interpolate
if "%(" in value:
TypeError: argument of type 'int' is not iterable
>>> config.set("popo", "bool", True)
>>> config.getboolean("popo", "bool")
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
config.getboolean("popo", "bool")
File "c:\Python30\lib\configparser.py", line 349, in getboolean
v = self.get(section, option)
File "c:\Python30\lib\configparser.py", line 545, in get
return self._interpolate(section, option, value, d)
File "c:\Python30\lib\configparser.py", line 585, in _interpolate
if "%(" in value:
TypeError: argument of type 'bool' is not iterable
>>> config.set("popo", "float", 3.21)
>>> config.getfloat("popo", "float")
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
config.getfloat("popo", "float")
File "c:\Python30\lib\configparser.py", line 343, in getfloat
return self._get(section, float, option)
File "c:\Python30\lib\configparser.py", line 337, in _get
return conv(self.get(section, option))
File "c:\Python30\lib\configparser.py", line 545, in get
return self._interpolate(section, option, value, d)
File "c:\Python30\lib\configparser.py", line 585, in _interpolate
if "%(" in value:
TypeError: argument of type 'float' is not iterable
Same things with python 2.6
----------
components: Library (Lib)
messages: 83055
nosy: Absynthe
severity: normal
status: open
title: ConfigParser get<int/float/boolean> methods broken
type: crash
versions: Python 2.6, Python 3.0
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5409>
_______________________________________
More information about the Python-bugs-list
mailing list