summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Galindo <Pablogsal@gmail.com>2019-08-26 14:52:25 (GMT)
committerGitHub <noreply@github.com>2019-08-26 14:52:25 (GMT)
commit0e4ea16336685cf3fa353d8c54af59b45b2d5c33 (patch)
treea0bb8ddacd204b322a85c7eba38a65d30715f675
parent1c0600998681295735a18690fae184b0c9a4ca51 (diff)
downloadcpython-0e4ea16336685cf3fa353d8c54af59b45b2d5c33.zip
cpython-0e4ea16336685cf3fa353d8c54af59b45b2d5c33.tar.gz
cpython-0e4ea16336685cf3fa353d8c54af59b45b2d5c33.tar.bz2
bpo-37947: Adjust correctly the recursion level in symtable for named expressions (GH-15499)
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2019-08-26-04-09-57.bpo-37947.mzAQtB.rst2
-rw-r--r--Python/symtable.c4
2 files changed, 5 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2019-08-26-04-09-57.bpo-37947.mzAQtB.rst b/Misc/NEWS.d/next/Core and Builtins/2019-08-26-04-09-57.bpo-37947.mzAQtB.rst
new file mode 100644
index 0000000..2b3b723
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2019-08-26-04-09-57.bpo-37947.mzAQtB.rst
@@ -0,0 +1,2 @@
+Adjust correctly the recursion level in the symtable generation for named
+expressions. Patch by Pablo Galindo.
diff --git a/Python/symtable.c b/Python/symtable.c
index e48baa8..18ea576 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -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);