mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if inside parentheses (GH-29757)
This commit is contained in:
parent
f4afc53bf6
commit
24c10d2943
8 changed files with 15 additions and 8 deletions
|
@ -399,7 +399,7 @@ _Pypegen_set_syntax_error(Parser* p, Token* last_token) {
|
|||
RAISE_SYNTAX_ERROR("error at start before reading any input");
|
||||
}
|
||||
// Parser encountered EOF (End of File) unexpectedtly
|
||||
if (p->tok->done == E_EOF) {
|
||||
if (last_token->type == ERRORTOKEN && p->tok->done == E_EOF) {
|
||||
if (p->tok->level) {
|
||||
raise_unclosed_parentheses_error(p);
|
||||
} else {
|
||||
|
@ -422,4 +422,4 @@ _Pypegen_set_syntax_error(Parser* p, Token* last_token) {
|
|||
// _PyPegen_tokenize_full_source_to_check_for_errors will override the existing
|
||||
// generic SyntaxError we just raised if errors are found.
|
||||
_PyPegen_tokenize_full_source_to_check_for_errors(p);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue