Skip to content

bpo-44143: Fix crash in the parser when raising tokenizer errors with an exception set #26144

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

Merged
merged 1 commit into from
May 15, 2021

Conversation

pablogsal
Copy link
Member

@pablogsal pablogsal commented May 15, 2021

@@ -1259,6 +1259,7 @@ _PyPegen_check_tokenizer_errors(Parser *p) {
if (p->tok->level != 0) {
int error_lineno = p->tok->parenlinenostack[p->tok->level-1];
if (current_err_line > error_lineno) {
PyErr_Clear();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any chance this code path might be hit with some other kind of error (e.g IndentationError, UnicodeDecodeError, MemoryError etc)? If not LGTM

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nop, only PyExc_SyntaxError

@pablogsal pablogsal merged commit 80b0891 into python:main May 15, 2021
@miss-islington
Copy link
Contributor

Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-26148 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label May 15, 2021
pablogsal added a commit that referenced this pull request May 15, 2021
… an exception set (GH-26144) (GH-26148)

(cherry picked from commit 80b0891)

Co-authored-by: Pablo Galindo <[email protected]>
@pablogsal pablogsal deleted the bpo-44143 branch May 19, 2021 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants