Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Lib/test/test_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def baz():
""", 9, 24)
check("pass\npass\npass\n(1+)\npass\npass\npass", 4, 4)
check("(1+)", 1, 4)
check("[interesting\nfoo()\n", 1, 1)

# Errors thrown by symtable.c
check('x = [(yield i) for i in range(3)]', 1, 5)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed a crash in the parser that manifest when raising tokenizer errors when
an existing exception was present. Patch by Pablo Galindo.
1 change: 1 addition & 0 deletions Parser/pegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy Markdown
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
Copy Markdown
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

raise_unclosed_parentheses_error(p);
return -1;
}
Expand Down