summaryrefslogtreecommitdiffstats
path: root/Python/opcode_metadata.h
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2023-02-07 23:44:37 (GMT)
committerGitHub <noreply@github.com>2023-02-07 23:44:37 (GMT)
commitaacbdb0c650492756738b044e6ddf8b72f89a1a2 (patch)
treef36e5be44c5415e626b72f0255f46a1615eff29e /Python/opcode_metadata.h
parent753fc8a5d64369cd228c3e43fef1811ac3cfde83 (diff)
downloadcpython-aacbdb0c650492756738b044e6ddf8b72f89a1a2.zip
cpython-aacbdb0c650492756738b044e6ddf8b72f89a1a2.tar.gz
cpython-aacbdb0c650492756738b044e6ddf8b72f89a1a2.tar.bz2
gh-98831: Finish the UNPACK_SEQUENCE family (#101666)
New generator feature: Generate useful glue for output arrays, so you can just write values to the output array (no bounds checking). Rewrote UNPACK_SEQUENCE_TWO_TUPLE to use this, and also UNPACK_SEQUENCE_{TUPLE,LIST}.
Diffstat (limited to 'Python/opcode_metadata.h')
-rw-r--r--Python/opcode_metadata.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h
index bae5492..c1e12a4 100644
--- a/Python/opcode_metadata.h
+++ b/Python/opcode_metadata.h
@@ -127,9 +127,9 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) {
case UNPACK_SEQUENCE_TWO_TUPLE:
return 1;
case UNPACK_SEQUENCE_TUPLE:
- return -1;
+ return 1;
case UNPACK_SEQUENCE_LIST:
- return -1;
+ return 1;
case UNPACK_EX:
return 1;
case STORE_ATTR:
@@ -473,11 +473,11 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) {
case UNPACK_SEQUENCE:
return oparg;
case UNPACK_SEQUENCE_TWO_TUPLE:
- return 2;
+ return oparg;
case UNPACK_SEQUENCE_TUPLE:
- return -1;
+ return oparg;
case UNPACK_SEQUENCE_LIST:
- return -1;
+ return oparg;
case UNPACK_EX:
return (oparg & 0xFF) + (oparg >> 8) + 1;
case STORE_ATTR:
@@ -765,9 +765,9 @@ struct opcode_metadata {
[STORE_NAME] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
[DELETE_NAME] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
[UNPACK_SEQUENCE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC },
- [UNPACK_SEQUENCE_TWO_TUPLE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IXC },
- [UNPACK_SEQUENCE_TUPLE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
- [UNPACK_SEQUENCE_LIST] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
+ [UNPACK_SEQUENCE_TWO_TUPLE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC },
+ [UNPACK_SEQUENCE_TUPLE] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC },
+ [UNPACK_SEQUENCE_LIST] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC },
[UNPACK_EX] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },
[STORE_ATTR] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IBC000 },
[DELETE_ATTR] = { DIR_NONE, DIR_NONE, DIR_NONE, true, INSTR_FMT_IB },