bpo-37947: Adjust correctly the recursion level in symtable for named expressions (GH-15499)

This commit is contained in:
Pablo Galindo 2019-08-26 15:52:25 +01:00 committed by GitHub
parent 1c06009986
commit 0e4ea16336
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -0,0 +1,2 @@
Adjust correctly the recursion level in the symtable generation for named
expressions. Patch by Pablo Galindo.

View File

@ -1508,6 +1508,7 @@ symtable_handle_namedexpr(struct symtable *st, expr_ty e)
}
VISIT(st, expr, e->v.NamedExpr.value);
VISIT(st, expr, e->v.NamedExpr.target);
VISIT_QUIT(st, 1);
}
static int
@ -1520,7 +1521,8 @@ symtable_visit_expr(struct symtable *st, expr_ty e)
}
switch (e->kind) {
case NamedExpr_kind:
symtable_handle_namedexpr(st, e);
if(!symtable_handle_namedexpr(st, e))
VISIT_QUIT(st, 0);
break;
case BoolOp_kind:
VISIT_SEQ(st, expr, e->v.BoolOp.values);