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 <rep...@bugs.python.org>
<http://bugs.python.org/issue24142>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to