Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e4ea16

Browse files
authored
bpo-37947: Adjust correctly the recursion level in symtable for named expressions (GH-15499)
1 parent 1c06009 commit 0e4ea16

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Adjust correctly the recursion level in the symtable generation for named
2+
expressions. Patch by Pablo Galindo.

Python/symtable.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1508,6 +1508,7 @@ symtable_handle_namedexpr(struct symtable *st, expr_ty e)
15081508
}
15091509
VISIT(st, expr, e->v.NamedExpr.value);
15101510
VISIT(st, expr, e->v.NamedExpr.target);
1511+
VISIT_QUIT(st, 1);
15111512
}
15121513

15131514
static int
@@ -1520,7 +1521,8 @@ symtable_visit_expr(struct symtable *st, expr_ty e)
15201521
}
15211522
switch (e->kind) {
15221523
case NamedExpr_kind:
1523-
symtable_handle_namedexpr(st, e);
1524+
if(!symtable_handle_namedexpr(st, e))
1525+
VISIT_QUIT(st, 0);
15241526
break;
15251527
case BoolOp_kind:
15261528
VISIT_SEQ(st, expr, e->v.BoolOp.values);

0 commit comments

Comments
 (0)