summaryrefslogtreecommitdiffstats
path: root/Parser/parser.c
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2021-11-24 22:21:23 (GMT)
committerGitHub <noreply@github.com>2021-11-24 22:21:23 (GMT)
commit24c10d2943c482c4d3ecc71d45df2d8c10fa5bb1 (patch)
treebcd92d5aa5eb38532813cd703dc7f728d20d230a /Parser/parser.c
parentf4afc53bf68c8ded20b281cd1baa88a679b4a3fd (diff)
downloadcpython-24c10d2943c482c4d3ecc71d45df2d8c10fa5bb1.zip
cpython-24c10d2943c482c4d3ecc71d45df2d8c10fa5bb1.tar.gz
cpython-24c10d2943c482c4d3ecc71d45df2d8c10fa5bb1.tar.bz2
bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if inside parentheses (GH-29757)
Diffstat (limited to 'Parser/parser.c')
-rw-r--r--Parser/parser.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Parser/parser.c b/Parser/parser.c
index b3aa359..1cf6e35 100644
--- a/Parser/parser.c
+++ b/Parser/parser.c
@@ -18298,7 +18298,7 @@ invalid_expression_rule(Parser *p)
)
{
D(fprintf(stderr, "%*c+ invalid_expression[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "!(NAME STRING | SOFT_KEYWORD) disjunction expression_without_invalid"));
- _res = _PyPegen_check_legacy_stmt ( p , a ) ? NULL : RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Perhaps you forgot a comma?" );
+ _res = _PyPegen_check_legacy_stmt ( p , a ) ? NULL : p -> tokens [p -> mark - 1] -> level == 0 ? NULL : RAISE_SYNTAX_ERROR_KNOWN_RANGE ( a , b , "invalid syntax. Perhaps you forgot a comma?" );
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
D(p->level--);