Issue 33504: configparser should use dict instead of OrderedDict in 3.7+ (original) (raw)

Issue33504

Created on 2018-05-14 18:18 by jreese, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 6819 merged jreese,2018-05-14 18:59
PR 11712 merged methane,2019-01-31 08:16
PR 11712 merged methane,2019-01-31 08:16
PR 11712 merged methane,2019-01-31 08:16
Messages (6)
msg316547 - (view) Author: John Reese (jreese) * Date: 2018-05-14 18:18
The configparser module uses `collections.OrderedDict` as its default, but this is no longer necessary in 3.7+ due to the semantics of core dictionaries being ordered by design. configparser should just use `dict` by default now, instead.
msg316550 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2018-05-14 18:55
Like #33463, it will require a deprecation cycle. I'm not sure it's worth the hassle, but I wouldn't oppose it if someone wanted to do the work. 3.8 would be the first version where it could be added.
msg316552 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-14 19:00
See in .
msg316620 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-05-15 04:45
I am +1 to changing it to dict for Python 3.8. This use case is different from `namedtuple._asdict`. The type of the dictionary is for the purpose of internal storage of the parser. Unlike `namedtuple._asdict`, it is not exposed to the user. The purpose of changing the default to OrderedDict in the past is not documented but implying from its properties we can deduce it was to make minimal edits to .ini files stable. This property will remain unchanged with changing the type back to `dict`. The history here is this: - a `dict_type` was introduced by MvL in r52908 (issue 1371075) with the motivation to allow sorting or order preservation (December 2006); - the default `dict_type` was changed by Raymond to OrderedDict for 3.1 in 0663a1ed793c164fb11d3dd62bebc677e260891e (March 2009); as far as I can tell there was no issue for it when that change was made. I acknowledge that in https://bugs.python.org/issue32360 Raymond states that "can't just change the default argument for configparser" but I don't see why. ConfigParser doesn't return the dictionary to the user in any API and the new 3.6+ dictionary preserves order just as OrderedDict.
msg318790 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2018-06-05 23:31
New changeset 3a5b0d8988491d9408b22bceea6fd70b91345724 by Łukasz Langa (John Reese) in branch 'master': bpo-33504: Migrate configparser from OrderedDict to dict. (#6819) https://github.com/python/cpython/commit/3a5b0d8988491d9408b22bceea6fd70b91345724
msg334615 - (view) Author: Inada Naoki (methane) * (Python committer) Date: 2019-01-31 08:53
New changeset 0897e0c597c065f043e4286d01f16f473ab664ee by Inada Naoki in branch 'master': bpo-33504: fix wrong "versionchanged" (GH-11712) https://github.com/python/cpython/commit/0897e0c597c065f043e4286d01f16f473ab664ee
History
Date User Action Args
2022-04-11 14:59:00 admin set github: 77685
2019-01-31 08:53:52 methane set nosy: + methanemessages: +
2019-01-31 08:17:09 methane set pull_requests: + <pull%5Frequest11572>
2019-01-31 08:16:57 methane set pull_requests: + <pull%5Frequest11571>
2019-01-31 08:16:48 methane set pull_requests: + <pull%5Frequest11570>
2018-06-05 23:33:57 lukasz.langa set status: open -> closedresolution: fixedstage: patch review -> resolved
2018-06-05 23:31:36 lukasz.langa set messages: +
2018-05-15 04:45:31 lukasz.langa set messages: +
2018-05-14 19:05:46 jreese set nosy: + lukasz.langa
2018-05-14 19:00:04 serhiy.storchaka set nosy: + rhettinger, serhiy.storchakamessages: +
2018-05-14 18:59:08 jreese set keywords: + patchstage: patch reviewpull_requests: + <pull%5Frequest6504>
2018-05-14 18:55:39 eric.smith set nosy: + eric.smithmessages: + versions: - Python 3.7
2018-05-14 18🔞18 jreese create