Skip to content

Questionable code in OrderedDict definition #77212

Closed

Description

@serhiy-storchaka
BPO 33031
Nosy @ericsnowcurrently, @serhiy-storchaka
PRs
  • bpo-33031: Remove dead code in C implementation of OrderedDict. #6120
  • [3.7] bpo-33031: Remove dead code in C implementation of OrderedDict. (GH-6120) #6433
  • 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-04-09.18:47:41.516>
    created_at = <Date 2018-03-08.18:39:09.341>
    labels = ['extension-modules', '3.8', 'build', '3.7']
    title = 'Questionable code in OrderedDict definition'
    updated_at = <Date 2018-04-09.18:47:41.515>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2018-04-09.18:47:41.515>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-04-09.18:47:41.516>
    closer = 'serhiy.storchaka'
    components = ['Extension Modules']
    creation = <Date 2018-03-08.18:39:09.341>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 33031
    keywords = ['patch']
    message_count = 3.0
    messages = ['313452', '315134', '315146']
    nosy_count = 2.0
    nosy_names = ['eric.snow', 'serhiy.storchaka']
    pr_nums = ['6120', '6433']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'compile error'
    url = 'https://bugs.python.org/issue33031'
    versions = ['Python 3.7', 'Python 3.8']

    Activity

    1. serhiy-storchaka commented on Mar 8, 2018

      @serhiy-storchaka
      MemberAuthor

      The array of PyMethodDef for OrderedDict contains explicit definitions of methods like __delitem__, __eq__ and __init__. The purpose is aligning docstrings with Python implementation. But this doesn't work. Slot wrappers replace these descriptors. And docstings are standard docstrings for corresponding slot wrappers.

      Thus this code doesn't work. And it looks dangerous, since functions are casted to incompatible function types. Even if they are never used, the compiler (gcc 8) produces warnings (see bpo-33012). May be this is even undefined behavior. In that case the compiler can generate arbitrary code.

      I suggest to remove these definitions.

    2. serhiy-storchaka commented on Apr 9, 2018

      @serhiy-storchaka
      MemberAuthor

      New changeset 827d49f by Serhiy Storchaka in branch 'master':
      bpo-33031: Remove dead code in C implementation of OrderedDict. (GH-6120)
      827d49f

    3. serhiy-storchaka commented on Apr 9, 2018

      @serhiy-storchaka
      MemberAuthor

      New changeset b0f387d by Serhiy Storchaka in branch '3.7':
      [3.7] bpo-33031: Remove dead code in C implementation of OrderedDict. (GH-6120) (GH-6433)
      b0f387d

    4. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      3.7 (EOL)end of life3.8 (EOL)end of lifebuildThe build process and cross-buildextension-modulesC modules in the Modules dir

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions