diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2021-04-13 16:51:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-13 16:51:21 (GMT) |
commit | 30ed93bfec5dfa7ee05982e2df8fd810f3f49305 (patch) | |
tree | 2ba7d8eaba2304ec562e5bb877f7a6e0975954fa /Parser | |
parent | fd79af7ae2574aaaa829e40ed780e17ef1f9be84 (diff) | |
download | cpython-30ed93bfec5dfa7ee05982e2df8fd810f3f49305.zip cpython-30ed93bfec5dfa7ee05982e2df8fd810f3f49305.tar.gz cpython-30ed93bfec5dfa7ee05982e2df8fd810f3f49305.tar.bz2 |
bpo-43797: Handle correctly invalid assignments inside function calls and generators (GH-25390)
Diffstat (limited to 'Parser')
-rw-r--r-- | Parser/parser.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Parser/parser.c b/Parser/parser.c index 38bab96..d158b29 100644 --- a/Parser/parser.c +++ b/Parser/parser.c @@ -14015,7 +14015,7 @@ group_rule(Parser *p) return _res; } -// genexp: '(' named_expression for_if_clauses ')' | invalid_comprehension +// genexp: '(' direct_named_expression for_if_clauses ')' | invalid_comprehension static expr_ty genexp_rule(Parser *p) { @@ -14035,12 +14035,12 @@ genexp_rule(Parser *p) UNUSED(_start_lineno); // Only used by EXTRA macro int _start_col_offset = p->tokens[_mark]->col_offset; UNUSED(_start_col_offset); // Only used by EXTRA macro - { // '(' named_expression for_if_clauses ')' + { // '(' direct_named_expression for_if_clauses ')' if (p->error_indicator) { D(p->level--); return NULL; } - D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' named_expression for_if_clauses ')'")); + D(fprintf(stderr, "%*c> genexp[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "'(' direct_named_expression for_if_clauses ')'")); Token * _literal; Token * _literal_1; expr_ty a; @@ -14048,14 +14048,14 @@ genexp_rule(Parser *p) if ( (_literal = _PyPegen_expect_token(p, 7)) // token='(' && - (a = named_expression_rule(p)) // named_expression + (a = direct_named_expression_rule(p)) // direct_named_expression && (b = for_if_clauses_rule(p)) // for_if_clauses && (_literal_1 = _PyPegen_expect_token(p, 8)) // token=')' ) { - D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' named_expression for_if_clauses ')'")); + D(fprintf(stderr, "%*c+ genexp[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "'(' direct_named_expression for_if_clauses ')'")); Token *_token = _PyPegen_get_last_nonnwhitespace_token(p); if (_token == NULL) { D(p->level--); @@ -14075,7 +14075,7 @@ genexp_rule(Parser *p) } p->mark = _mark; D(fprintf(stderr, "%*c%s genexp[%d-%d]: %s failed!\n", p->level, ' ', - p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' named_expression for_if_clauses ')'")); + p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "'(' direct_named_expression for_if_clauses ')'")); } if (p->call_invalid_rules) { // invalid_comprehension if (p->error_indicator) { |