summaryrefslogtreecommitdiffstats
path: root/Parser/pegen.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/pegen.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/pegen.c')
-rw-r--r--Parser/pegen.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Parser/pegen.c b/Parser/pegen.c
index 4f51c63..ede281a 100644
--- a/Parser/pegen.c
+++ b/Parser/pegen.c
@@ -170,6 +170,8 @@ initialize_token(Parser *p, Token *token, const char *start, const char *end, in
return -1;
}
+ token->level = p->tok->level;
+
const char *line_start = token_type == STRING ? p->tok->multi_line_start : p->tok->line_start;
int lineno = token_type == STRING ? p->tok->first_lineno : p->tok->lineno;
int end_lineno = p->tok->lineno;
@@ -946,4 +948,4 @@ _PyPegen_run_parser_from_string(const char *str, int start_rule, PyObject *filen
error:
_PyTokenizer_Free(tok);
return result;
-} \ No newline at end of file
+}