summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorzq1997 <email2zq@qq.com>2022-01-17 17:45:44 (GMT)
committerGitHub <noreply@github.com>2022-01-17 17:45:44 (GMT)
commitc118c2455c95baea08045dc64963600b7a56b6fd (patch)
tree123654926c6f7000d497917ed1dd38374f8407a1 /Python/compile.c
parent62a6594e66ca955073be2f4e5a40291a39252ef3 (diff)
downloadcpython-c118c2455c95baea08045dc64963600b7a56b6fd.zip
cpython-c118c2455c95baea08045dc64963600b7a56b6fd.tar.gz
cpython-c118c2455c95baea08045dc64963600b7a56b6fd.tar.bz2
bpo-46161: Fix bug in starunpack_helper in compile.c (GH-30235)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index b2702da..86f888e 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -4233,7 +4233,7 @@ starunpack_helper(struct compiler *c, asdl_expr_seq *elts, int pushed,
Py_INCREF(val);
PyTuple_SET_ITEM(folded, i, val);
}
- if (tuple) {
+ if (tuple && !pushed) {
ADDOP_LOAD_CONST_NEW(c, folded);
} else {
if (add == SET_ADD) {
@@ -4245,6 +4245,9 @@ starunpack_helper(struct compiler *c, asdl_expr_seq *elts, int pushed,
ADDOP_I(c, build, pushed);
ADDOP_LOAD_CONST_NEW(c, folded);
ADDOP_I(c, extend, 1);
+ if (tuple) {
+ ADDOP(c, LIST_TO_TUPLE);
+ }
}
return 1;
}