Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configparser should use dict instead of OrderedDict in 3.7+ #77685

Closed
jreese mannequin opened this issue May 14, 2018 · 6 comments
Closed

configparser should use dict instead of OrderedDict in 3.7+ #77685

jreese mannequin opened this issue May 14, 2018 · 6 comments
Labels
3.8 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@jreese
Copy link
Mannequin

jreese mannequin commented May 14, 2018

BPO 33504
Nosy @rhettinger, @ericvsmith, @methane, @ambv, @jreese, @serhiy-storchaka
PRs
  • bpo-33504: Migrate configparser from OrderedDict to dict. #6819
  • bpo-33504: fix wrong "versionchanged" #11712
  • bpo-33504: fix wrong "versionchanged" #11712
  • bpo-33504: fix wrong "versionchanged" #11712
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-06-05.23:33:57.534>
    created_at = <Date 2018-05-14.18:18:18.612>
    labels = ['3.8', 'type-feature', 'library']
    title = 'configparser should use dict instead of OrderedDict in 3.7+'
    updated_at = <Date 2019-01-31.08:53:52.064>
    user = 'https://github.com/jreese'

    bugs.python.org fields:

    activity = <Date 2019-01-31.08:53:52.064>
    actor = 'methane'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-06-05.23:33:57.534>
    closer = 'lukasz.langa'
    components = ['Library (Lib)']
    creation = <Date 2018-05-14.18:18:18.612>
    creator = 'jreese'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33504
    keywords = ['patch']
    message_count = 6.0
    messages = ['316547', '316550', '316552', '316620', '318790', '334615']
    nosy_count = 6.0
    nosy_names = ['rhettinger', 'eric.smith', 'methane', 'lukasz.langa', 'jreese', 'serhiy.storchaka']
    pr_nums = ['6819', '11712', '11712', '11712']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue33504'
    versions = ['Python 3.8']

    @jreese
    Copy link
    Mannequin Author

    jreese mannequin commented May 14, 2018

    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.

    @jreese jreese mannequin added 3.7 (EOL) end of life 3.8 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels May 14, 2018
    @ericvsmith
    Copy link
    Member

    Like bpo-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.

    @ericvsmith ericvsmith removed the 3.7 (EOL) end of life label May 14, 2018
    @serhiy-storchaka
    Copy link
    Member

    See msg308974 in bpo-32360.

    @ambv
    Copy link
    Contributor

    ambv commented May 15, 2018

    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 (bpo-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 0663a1e (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.

    @ambv
    Copy link
    Contributor

    ambv commented Jun 5, 2018

    New changeset 3a5b0d8 by Łukasz Langa (John Reese) in branch 'master':
    bpo-33504: Migrate configparser from OrderedDict to dict. (bpo-6819)
    3a5b0d8

    @ambv ambv closed this as completed Jun 5, 2018
    @methane
    Copy link
    Member

    methane commented Jan 31, 2019

    New changeset 0897e0c by Inada Naoki in branch 'master':
    bpo-33504: fix wrong "versionchanged" (GH-11712)
    0897e0c

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 (EOL) end of life stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants