aboutsummaryrefslogtreecommitdiff
path: root/Parser
diff options
context:
space:
mode:
authorLysandros Nikolaou <lisandrosnik@gmail.com>2020-11-17 01:09:35 +0200
committerGitHub <noreply@github.com>2020-11-17 01:09:35 +0200
commitcae60187cf7a7b26281d012e1952fafe4e2e97e9 (patch)
tree90fe6ee32f7e1df5f6bda8701d7bf5f434f4f382 /Parser
parentbpo-42374: Allow unparenthesized walrus in genexps (GH-23319) (diff)
downloadcpython-cae60187cf7a7b26281d012e1952fafe4e2e97e9.tar.gz
cpython-cae60187cf7a7b26281d012e1952fafe4e2e97e9.tar.bz2
cpython-cae60187cf7a7b26281d012e1952fafe4e2e97e9.zip
bpo-42316: Allow unparenthesized walrus operator in indexes (GH-23317)
Diffstat (limited to 'Parser')
-rw-r--r--Parser/parser.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Parser/parser.c b/Parser/parser.c
index 94e26588198..2f6d68f41e8 100644
--- a/Parser/parser.c
+++ b/Parser/parser.c
@@ -10639,7 +10639,7 @@ slices_rule(Parser *p)
return _res;
}
-// slice: expression? ':' expression? [':' expression?] | expression
+// slice: expression? ':' expression? [':' expression?] | named_expression
static expr_ty
slice_rule(Parser *p)
{
@@ -10701,18 +10701,18 @@ slice_rule(Parser *p)
D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression? ':' expression? [':' expression?]"));
}
- { // expression
+ { // named_expression
if (p->error_indicator) {
D(p->level--);
return NULL;
}
- D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "expression"));
+ D(fprintf(stderr, "%*c> slice[%d-%d]: %s\n", p->level, ' ', _mark, p->mark, "named_expression"));
expr_ty a;
if (
- (a = expression_rule(p)) // expression
+ (a = named_expression_rule(p)) // named_expression
)
{
- D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "expression"));
+ D(fprintf(stderr, "%*c+ slice[%d-%d]: %s succeeded!\n", p->level, ' ', _mark, p->mark, "named_expression"));
_res = a;
if (_res == NULL && PyErr_Occurred()) {
p->error_indicator = 1;
@@ -10723,7 +10723,7 @@ slice_rule(Parser *p)
}
p->mark = _mark;
D(fprintf(stderr, "%*c%s slice[%d-%d]: %s failed!\n", p->level, ' ',
- p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "expression"));
+ p->error_indicator ? "ERROR!" : "-", _mark, p->mark, "named_expression"));
}
_res = NULL;
done: