From 80fd31a37252cc109f297637422e7d94f2213754 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Fri, 6 Mar 2020 23:03:14 -0800 Subject: [PATCH 1/4] Don't mangle the AST when compiling. --- Python/compile.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Python/compile.c b/Python/compile.c index f603e3d29e539d..f228e16079b289 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -3765,7 +3765,6 @@ assignment_helper(struct compiler *c, asdl_seq *elts) "star-unpacking assignment"); ADDOP_I(c, UNPACK_EX, (i + ((n-i-1) << 8))); seen_star = 1; - asdl_seq_SET(elts, i, elt->v.Starred.value); } else if (elt->kind == Starred_kind) { return compiler_error(c, @@ -3775,7 +3774,10 @@ assignment_helper(struct compiler *c, asdl_seq *elts) if (!seen_star) { ADDOP_I(c, UNPACK_SEQUENCE, n); } - VISIT_SEQ(c, expr, elts); + for (i = 0; i < n; i++) { + expr_ty elt = asdl_seq_GET(elts, i); + VISIT(c, expr, elt->kind != Starred_kind ? elt : elt->v.Starred.value); + } return 1; } From 0cad932a0c697e55bab4a5200c21f8142e95864c Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sat, 7 Mar 2020 12:35:39 -0800 Subject: [PATCH 2/4] Add NEWS entry. --- .../Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst b/Misc/NEWS.d/next/Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst new file mode 100644 index 00000000000000..8f83929797fc13 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst @@ -0,0 +1 @@ +Don't mutate the ast when compiling starred assignments. From a4f0fe38957d15575fc2e5a2266c2e5dfd1e7187 Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sat, 7 Mar 2020 12:38:32 -0800 Subject: [PATCH 3/4] Capitalize AST. --- .../Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst b/Misc/NEWS.d/next/Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst index 8f83929797fc13..64c4a5dd7d7d04 100644 --- a/Misc/NEWS.d/next/Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst +++ b/Misc/NEWS.d/next/Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst @@ -1 +1 @@ -Don't mutate the ast when compiling starred assignments. +Don't mutate the AST when compiling starred assignments. From 07a12a9641e6190dda586294df8c992c0718934a Mon Sep 17 00:00:00 2001 From: Brandt Bucher Date: Sat, 7 Mar 2020 18:50:11 -0800 Subject: [PATCH 4/4] Drop NEWS. --- .../Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst b/Misc/NEWS.d/next/Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst deleted file mode 100644 index 64c4a5dd7d7d04..00000000000000 --- a/Misc/NEWS.d/next/Core and Builtins/2020-03-07-12-35-31.bpo-39890.zr6CNx.rst +++ /dev/null @@ -1 +0,0 @@ -Don't mutate the AST when compiling starred assignments.