[New-bugs-announce] [issue24142] ConfigParser._read doesn't join multi-line values collected while reading if a ParsingError occured
Florian Höch
report at bugs.python.org
Thu May 7 17:54:46 CEST 2015
New submission from Florian Höch:
If a ParsingError occurs while reading a config file, the multi-line values collected while reading will never be joined because the error is raised before this can happen. This leads to very unexpected results, e.g. consider the following config.ini:
[DEFAULT]
test = test
invalid
>>> cfg = ConfigParser.ConfigParser()
>>> cfg.read(['config.ini'])
This will raise a ParsingError as expected. But the option values that were parsed without error are now all lists instead of strings:
>>> cfg.get('DEFAULT', test')
['test']
Patch attached.
----------
components: Library (Lib)
files: ConfigParser.py.patch
keywords: patch
messages: 242718
nosy: fhoech
priority: normal
severity: normal
status: open
title: ConfigParser._read doesn't join multi-line values collected while reading if a ParsingError occured
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file39312/ConfigParser.py.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24142>
_______________________________________
More information about the New-bugs-announce
mailing list