[New-bugs-announce] [issue33251] ConfigParser.items returns items present in vars

Tim Shaffer report at bugs.python.org
Mon Apr 9 16:04:26 EDT 2018


New submission from Tim Shaffer <timshaffer at me.com>:

The documentation for ConfigParser.items(section, raw=False, vars=None) says the following:

> Changed in version 3.2: Items present in vars no longer appear in the result. The previous behaviour mixed actual parser options with variables provided for interpolation.

https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.items

However, this does not seem to be the case. The keys from vars are present in the output. Tested on 3.6.5.

This example shows the issue:

    import configparser

    config = configparser.ConfigParser()

    config.add_section('example')
    config.set('example', 'name', 'timster %(suffix)s')

    data = config.items('example', vars={'suffix': 'user'})

    print(data)


Expected output:

    [('name', 'timster user')]

Actual output:

    [('name', 'timster user'), ('suffix', 'user')]

----------
components: Library (Lib)
messages: 315148
nosy: timster
priority: normal
severity: normal
status: open
title: ConfigParser.items returns items present in vars
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33251>
_______________________________________


More information about the New-bugs-announce mailing list