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

Crash in string annotations in lambda with keyword-only argument without default value #79035

Closed
serhiy-storchaka opened this issue Sep 30, 2018 · 5 comments
Labels
3.7 (EOL) end of life 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@serhiy-storchaka
Copy link
Member

BPO 34854
Nosy @gvanrossum, @ambv, @serhiy-storchaka, @miss-islington
PRs
  • bpo-34854: Fix a crash in string annotations containing specific lambda. #9645
  • [3.7] bpo-34854: Fix compiling string annotations containing lambdas. (GH-9645) #9646
  • 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-09-30.18:33:39.148>
    created_at = <Date 2018-09-30.16:25:00.255>
    labels = ['interpreter-core', '3.7', '3.8', 'type-crash']
    title = 'Crash in string annotations in lambda with keyword-only argument without default value'
    updated_at = <Date 2018-09-30.18:41:05.594>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2018-09-30.18:41:05.594>
    actor = 'gvanrossum'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-09-30.18:33:39.148>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2018-09-30.16:25:00.255>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 34854
    keywords = ['patch']
    message_count = 5.0
    messages = ['326730', '326737', '326739', '326742', '326743']
    nosy_count = 4.0
    nosy_names = ['gvanrossum', 'lukasz.langa', 'serhiy.storchaka', 'miss-islington']
    pr_nums = ['9645', '9646']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue34854'
    versions = ['Python 3.7', 'Python 3.8']

    @serhiy-storchaka
    Copy link
    Member Author

    Compiling a string annotation containing a lambda with keyword-only argument without default value causes a crash.

    from __future__ import annotations
    def f() -> (lambda *, x: x): pass

    The following PR fixes this crash. It also fixes other errors:

    • Removes a space between "lambda" and ":" in the representation of lambda without argument.

    • Removes the final "*" (it is incorrect syntax) in the representation of lambda without *args and keyword-only arguments when compile from AST.

    @serhiy-storchaka serhiy-storchaka added 3.7 (EOL) end of life 3.8 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump labels Sep 30, 2018
    @serhiy-storchaka
    Copy link
    Member Author

    New changeset 2a2940e by Serhiy Storchaka in branch 'master':
    bpo-34854: Fix compiling string annotations containing lambdas. (GH-9645)
    2a2940e

    @miss-islington
    Copy link
    Contributor

    New changeset 0f161b3 by Miss Islington (bot) in branch '3.7':
    bpo-34854: Fix compiling string annotations containing lambdas. (GH-9645)
    0f161b3

    @serhiy-storchaka
    Copy link
    Member Author

    These bugs was found when working on bpo-34856.

    @gvanrossum
    Copy link
    Member

    Should go to @ambv.

    On Sun, Sep 30, 2018 at 9:29 AM Serhiy Storchaka <report@bugs.python.org>
    wrote:

    Change by Serhiy Storchaka <storchaka+cpython@gmail.com>:

    ----------
    keywords: +patch
    pull_requests: +9037
    stage: -> patch review


    Python tracker <report@bugs.python.org>
    <https://bugs.python.org/issue34854\>


    --
    --Guido (mobile)

    @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 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