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

Incorrect function signatures in dictobject.c #88280

Closed
joemarshall mannequin opened this issue May 12, 2021 · 6 comments
Closed

Incorrect function signatures in dictobject.c #88280

joemarshall mannequin opened this issue May 12, 2021 · 6 comments
Labels
3.9 only security fixes 3.10 only security fixes 3.11 bug and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@joemarshall
Copy link
Mannequin

joemarshall mannequin commented May 12, 2021

BPO 44114
Nosy @methane, @serhiy-storchaka, @miss-islington, @joemarshall
PRs
  • bpo-44114: Fix dictkeys_reversed and dictvalues_reversed function signatures #26062
  • [3.10] bpo-44114: Fix dictkeys_reversed and dictvalues_reversed function signatures (GH-26062) #26092
  • [3.9] bpo-44114: Fix dictkeys_reversed and dictvalues_reversed function signatures (GH-26062) #26093
  • [3.8] bpo-44114: Fix dictkeys_reversed and dictvalues_reversed function signatures (GH-26062) #26094
  • bpo-44114: Remove redundant cast. #26098
  • [3.10] bpo-44114: Remove redundant cast. (GH-26098) #26107
  • [3.9] bpo-44114: Remove redundant cast. (GH-26098) #26108
  • [3.8] bpo-44114: Remove redundant cast. (GH-26098) #26109
  • 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 2021-05-13.21:21:36.855>
    created_at = <Date 2021-05-12.12:46:01.618>
    labels = ['interpreter-core', '3.10', '3.9', 'type-crash', '3.11']
    title = 'Incorrect function signatures in dictobject.c'
    updated_at = <Date 2021-05-16.14:34:47.264>
    user = 'https://github.com/joemarshall'

    bugs.python.org fields:

    activity = <Date 2021-05-16.14:34:47.264>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-05-13.21:21:36.855>
    closer = 'pitrou'
    components = ['Interpreter Core']
    creation = <Date 2021-05-12.12:46:01.618>
    creator = 'joemarshall'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44114
    keywords = ['patch']
    message_count = 6.0
    messages = ['393506', '393563', '393564', '393604', '393605', '393744']
    nosy_count = 4.0
    nosy_names = ['methane', 'serhiy.storchaka', 'miss-islington', 'joemarshall']
    pr_nums = ['26062', '26092', '26093', '26094', '26098', '26107', '26108', '26109']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue44114'
    versions = ['Python 3.9', 'Python 3.10', 'Python 3.11']

    @joemarshall
    Copy link
    Mannequin Author

    joemarshall mannequin commented May 12, 2021

    There's a couple of wrong function signatures in dictobject.c,

    dictkeys_reversed and dictitems_reversed are defined as single arg functions like so: PyObject *(PyObject *), and are then passed around and called as PyCFunctions, which should be PyObject *(PyObject *self,PyObject *args). dictvalues_reversed is correct.

    This works fine on most C compilers as the extra arg is just ignored, but on things that use strict function pointer type checking (e.g. webassembly), it crashes (and hence any of the tests that happen to use these functions fails, which is a surprising number)

    I've got a fix in my pyodide repo, which I'll chuck in as a pull request on github.

    @joemarshall joemarshall mannequin added type-bug An unexpected behavior, bug, or error interpreter-core (Objects, Python, Grammar, and Parser dirs) labels May 12, 2021
    @serhiy-storchaka
    Copy link
    Member

    Good catch! The signature of dictkeys_reversed was already fixed (for purity reason), but the same bug in dictvalues_reversed and dictitems_reversed was missed. It is nice that such bugs can now be caught by tools.

    @serhiy-storchaka serhiy-storchaka added 3.8 only security fixes 3.9 only security fixes 3.10 only security fixes 3.11 bug and security fixes type-crash A hard crash of the interpreter, possibly with a core dump and removed type-bug An unexpected behavior, bug, or error labels May 13, 2021
    @miss-islington
    Copy link
    Contributor

    New changeset 7cbe6ca by Miss Islington (bot) in branch '3.10':
    bpo-44114: Fix dictkeys_reversed and dictvalues_reversed function signatures (GH-26062)
    7cbe6ca

    @pitrou pitrou removed 3.8 only security fixes labels May 13, 2021
    @miss-islington
    Copy link
    Contributor

    New changeset 04c4610 by Miss Islington (bot) in branch '3.9':
    bpo-44114: Remove redundant cast. (GH-26098)
    04c4610

    @miss-islington
    Copy link
    Contributor

    New changeset c4c3beb by Miss Islington (bot) in branch '3.10':
    bpo-44114: Remove redundant cast. (GH-26098)
    c4c3beb

    @pitrou pitrou closed this as completed May 13, 2021
    @pitrou pitrou closed this as completed May 13, 2021
    @serhiy-storchaka
    Copy link
    Member

    New changeset 925cb85 by Miss Islington (bot) in branch '3.9':
    bpo-44114: Fix dictkeys_reversed and dictvalues_reversed function signatures (GH-26062) (GH-26093)
    925cb85

    @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.9 only security fixes 3.10 only security fixes 3.11 bug and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants