This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Pegen's nice error reporting crashes with non-UTF-8 files
Type: crash Stage: resolved
Components: Parser Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: lukasz.langa, lys.nikolaou, pablogsal, petr.viktorin
Priority: normal Keywords: patch

Created on 2021-11-19 17:46 by petr.viktorin, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
missing_paren_ascii.py petr.viktorin, 2021-11-19 17:46
Pull Requests
URL Status Linked Edit
PR 29626 closed pablogsal, 2021-11-19 19:00
PR 29646 merged pablogsal, 2021-11-19 23:06
PR 29661 merged lukasz.langa, 2021-11-20 15:04
Messages (4)
msg406602 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-11-19 17:46
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)
msg406657 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-11-20 14:36
New changeset fdcc46d9554094994f78bedf6dc9220e5d5ee668 by Pablo Galindo Salgado in branch 'main':
bpo-45848: Allow the parser to get error lines from encoded files (GH-29646)
https://github.com/python/cpython/commit/fdcc46d9554094994f78bedf6dc9220e5d5ee668
msg406661 - (view) Author: Łukasz Langa (lukasz.langa) * (Python committer) Date: 2021-11-20 15:35
New changeset 904af3de2bef6d971463a564541cb6dadf22d7f8 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)
https://github.com/python/cpython/commit/904af3de2bef6d971463a564541cb6dadf22d7f8
msg406832 - (view) Author: Petr Viktorin (petr.viktorin) * (Python committer) Date: 2021-11-23 10:13
Wow! Thank you for the quick fix!
History
Date User Action Args
2022-04-11 14:59:52adminsetgithub: 90006
2021-11-23 10:13:40petr.viktorinsetmessages: + msg406832
2021-11-20 17:38:46pablogsalsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2021-11-20 15:35:05lukasz.langasetmessages: + msg406661
2021-11-20 15:04:59lukasz.langasetpull_requests: + pull_request27903
2021-11-20 14:36:16lukasz.langasetnosy: + lukasz.langa
messages: + msg406657
2021-11-19 23:06:52pablogsalsetpull_requests: + pull_request27878
2021-11-19 19:01:10lukasz.langasettype: crash
2021-11-19 19:00:06pablogsalsetkeywords: + patch
stage: patch review
pull_requests: + pull_request27876
2021-11-19 17:47:02petr.viktorinsettitle: Pegen's nice error reporting crashes non-UTF-8 files -> Pegen's nice error reporting crashes with non-UTF-8 files
2021-11-19 17:46:25petr.viktorincreate