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

Pegen's nice error reporting crashes with non-UTF-8 files #90006

Closed
encukou opened this issue Nov 19, 2021 · 4 comments
Closed

Pegen's nice error reporting crashes with non-UTF-8 files #90006

encukou opened this issue Nov 19, 2021 · 4 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@encukou
Copy link
Member

encukou commented Nov 19, 2021

BPO 45848
Nosy @encukou, @ambv, @lysnikolaou, @pablogsal
PRs
  • bpo-45848: Delimitate when source lines can't be located in the parser error handling functions #29626
  • bpo-45848: Allow the parser to get error lines from encoded files #29646
  • [3.10] bpo-45848: Allow the parser to get error lines from encoded files (GH-29646) #29661
  • Files
  • missing_paren_ascii.py
  • 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-11-20.17:38:46.180>
    created_at = <Date 2021-11-19.17:46:25.521>
    labels = ['interpreter-core', 'type-crash']
    title = "Pegen's nice error reporting crashes with non-UTF-8 files"
    updated_at = <Date 2021-11-23.10:13:40.038>
    user = 'https://github.com/encukou'

    bugs.python.org fields:

    activity = <Date 2021-11-23.10:13:40.038>
    actor = 'petr.viktorin'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-11-20.17:38:46.180>
    closer = 'pablogsal'
    components = ['Parser']
    creation = <Date 2021-11-19.17:46:25.521>
    creator = 'petr.viktorin'
    dependencies = []
    files = ['50451']
    hgrepos = []
    issue_num = 45848
    keywords = ['patch']
    message_count = 4.0
    messages = ['406602', '406657', '406661', '406832']
    nosy_count = 4.0
    nosy_names = ['petr.viktorin', 'lukasz.langa', 'lys.nikolaou', 'pablogsal']
    pr_nums = ['29626', '29646', '29661']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue45848'
    versions = []

    @encukou
    Copy link
    Member Author

    encukou commented Nov 19, 2021

    Parsing a script with non-UTF-8 encoding and a missing close parenthesis, like a file with the following 2 lines:

    # encoding: ascii
    (

    ... crashes with:

    python: Parser/pegen.c:408: get_error_line: Assertion `p->tok->fp == NULL || p->tok->fp == stdin' failed.
    Aborted (core dumped)

    @encukou encukou added interpreter-core (Objects, Python, Grammar, and Parser dirs) labels Nov 19, 2021
    @encukou encukou changed the title Pegen's nice error reporting crashes non-UTF-8 files Pegen's nice error reporting crashes with non-UTF-8 files Nov 19, 2021
    @encukou encukou changed the title Pegen's nice error reporting crashes non-UTF-8 files Pegen's nice error reporting crashes with non-UTF-8 files Nov 19, 2021
    @ambv ambv added type-crash A hard crash of the interpreter, possibly with a core dump labels Nov 19, 2021
    @ambv
    Copy link
    Contributor

    ambv commented Nov 20, 2021

    New changeset fdcc46d by Pablo Galindo Salgado in branch 'main':
    bpo-45848: Allow the parser to get error lines from encoded files (GH-29646)
    fdcc46d

    @ambv
    Copy link
    Contributor

    ambv commented Nov 20, 2021

    New changeset 904af3d by Łukasz Langa in branch '3.10':
    [3.10] bpo-45848: Allow the parser to get error lines from encoded files (GH-29646) (GH-29661)
    904af3d

    @encukou
    Copy link
    Member Author

    encukou commented Nov 23, 2021

    Wow! Thank you for the quick fix!

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