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

Questionable code in OrderedDict definition #77212

Closed
serhiy-storchaka opened this issue Mar 8, 2018 · 3 comments
Closed

Questionable code in OrderedDict definition #77212

serhiy-storchaka opened this issue Mar 8, 2018 · 3 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes build The build process and cross-build extension-modules C modules in the Modules dir

Comments

@serhiy-storchaka
Copy link
Member

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']

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    @serhiy-storchaka serhiy-storchaka added 3.8 only security fixes extension-modules C modules in the Modules dir build The build process and cross-build 3.7 (EOL) end of life labels Mar 8, 2018
    @serhiy-storchaka
    Copy link
    Member Author

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

    @serhiy-storchaka
    Copy link
    Member Author

    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

    @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.7 (EOL) end of life 3.8 only security fixes build The build process and cross-build extension-modules C modules in the Modules dir
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant