Issue 33251: ConfigParser.items returns items present in vars (original) (raw)

Created on 2018-04-09 20:04 by timster, last changed 2022-04-11 14:58 by admin.

Pull Requests
URL Status Linked Edit
PR 6446 merged chrBrd,2018-04-10 19:18
PR 6494 merged lukasz.langa,2018-04-17 02:47
PR 6495 merged miss-islington,2018-04-17 03:04
PR 6496 merged miss-islington,2018-04-17 03:04
PR 6567 closed chrBrd,2018-04-22 21:13
PR 6583 merged chrBrd,2018-04-23 20:22
Messages (7)
msg315148 - (view) Author: Tim Shaffer (timster) Date: 2018-04-09 20:04
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')]
msg315374 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-04-17 02:36
Hm. The documentation change was done in but it seems this was actually never the case, contrary to what the conversation on that other issue there states. I wouldn't change it for 3.6.6 anymore since it's pretty late in the release cycle. This looks like an interesting bug fix for 3.7.
msg315375 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-04-17 02:40
Well, now that I think about it, this is not even a *bug* fix since it's behavior that configparser had since 1997. So that will have to go straight to 3.8.
msg315390 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-04-17 10:29
What *actually* was changed in 3.2?
msg315628 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-04-22 21:37
> What *actually* was changed in 3.2? In terms of this issue, nothing. That piece of documentation was put without proper testing, based purely on a comment that somebody put on . My mistake.
msg315673 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-04-23 19:16
New changeset 1d4a733cceee237f0850b7887c2945dee707da27 by Łukasz Langa (Chris Bradbury) in branch 'master': bpo-33251: Prevent ConfigParser.items returning items present in vars. (#6446) https://github.com/python/cpython/commit/1d4a733cceee237f0850b7887c2945dee707da27
msg315679 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-04-23 20:56
New changeset e500839796c7fa43998e72edb77165872b9ce034 by Łukasz Langa (Chris Bradbury) in branch 'master': bpo-33251: Update documentation to reflect change. (GH-6446) (#6583) https://github.com/python/cpython/commit/e500839796c7fa43998e72edb77165872b9ce034
History
Date User Action Args
2022-04-11 14:58:59 admin set github: 77432
2018-04-23 20:56:49 lukasz.langa set messages: +
2018-04-23 20:22:45 chrBrd set pull_requests: + <pull%5Frequest6283>
2018-04-23 19:16:23 lukasz.langa set messages: +
2018-04-22 21:37:43 lukasz.langa set messages: +
2018-04-22 21:13:47 chrBrd set pull_requests: + <pull%5Frequest6264>
2018-04-17 10:29:13 serhiy.storchaka set nosy: + serhiy.storchakamessages: +
2018-04-17 03:04:22 miss-islington set pull_requests: + <pull%5Frequest6193>
2018-04-17 03:04:17 miss-islington set pull_requests: + <pull%5Frequest6192>
2018-04-17 02:47:13 lukasz.langa set pull_requests: + <pull%5Frequest6191>
2018-04-17 02:40:00 lukasz.langa set messages: + versions: + Python 3.8, - Python 3.6
2018-04-17 02:36:25 lukasz.langa set messages: +
2018-04-13 19:50:39 terry.reedy set nosy: + terry.reedy
2018-04-10 19🔞54 chrBrd set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest6141>
2018-04-10 14:37:05 ned.deily set nosy: + lukasz.langa
2018-04-09 20:10:13 timster set type: behavior
2018-04-09 20:04:26 timster create