[New-bugs-announce] [issue26831] ConfigParser parsing failures with default_section and ExtendedInterpolation options

Hans-Peter Jansen report at bugs.python.org
Fri Apr 22 18:37:37 EDT 2016


New submission from Hans-Peter Jansen:

ConfigParser fails in interesting ways, when using default_section and ExtendedInterpolation options. Running the attached script results in: 

ConfigParser() with expected result:
global: [('loglevel', 'WARNING'), ('logfile', '-')]
section1: [('key_a', 'value'), ('key_b', 'morevalue')]
section2: [('key_c', 'othervalue'), ('key_d', 'differentvalue')]

ConfigParser(default_section='global') mangles section separation:
section1: [('loglevel', 'WARNING'), ('logfile', '-'), ('key_a', 'value'), ('key_b', 'morevalue')]
section2: [('loglevel', 'WARNING'), ('logfile', '-'), ('key_c', 'othervalue'), ('key_d', 'differentvalue')]

ConfigParser(interpolation=ExtendedInterpolation) fails with strange error:
Traceback (most recent call last):
  File "configparser-test.py", line 36, in <module>
    print_sections(cp)
  File "configparser-test.py", line 21, in print_sections
    cp.read_string(__doc__)
  File "/usr/lib64/python3.4/configparser.py", line 696, in read_string
    self.read_file(sfile, source)
  File "/usr/lib64/python3.4/configparser.py", line 691, in read_file
    self._read(f, source)
  File "/usr/lib64/python3.4/configparser.py", line 1089, in _read
    self._join_multiline_values()
  File "/usr/lib64/python3.4/configparser.py", line 1101, in _join_multiline_values
    name, val)
TypeError: before_read() missing 1 required positional argument: 'value'

while it is expected to behave identical.

----------
components: Library (Lib)
files: configparser-test.py
messages: 264031
nosy: frispete
priority: normal
severity: normal
status: open
title: ConfigParser parsing failures with default_section and ExtendedInterpolation options
versions: Python 3.4
Added file: http://bugs.python.org/file42573/configparser-test.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue26831>
_______________________________________


More information about the New-bugs-announce mailing list