Bug description
When ConfigParser uses allow_no_value=True, calling getboolean() on a value-less option raises AttributeError instead of the documented ValueError.
Documentation:
https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.getboolean
Reproducer
import configparser
config = configparser.ConfigParser(allow_no_value=True)
config.read_string("""
[section]
enabled
""")
assert config.get("section", "enabled") is None
config.getboolean("section", "enabled")
Current result:
AttributeError: 'NoneType' object has no attribute 'lower'
Expected result:
ValueError: Not a boolean: None
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Bug description
When
ConfigParserusesallow_no_value=True, callinggetboolean()on a value-less option raisesAttributeErrorinstead of the documentedValueError.Documentation:
https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.getboolean
Reproducer
Current result:
Expected result:
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs