summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorBrandt Bucher <brandt@python.org>2022-01-04 19:38:32 (GMT)
committerGitHub <noreply@github.com>2022-01-04 19:38:32 (GMT)
commit31e43cbe5f01cdd5b5ab330ec3040920e8b61a91 (patch)
treed1fe86279c419ff34eae29c77a538b1d053f47cc /Python
parentf404e26d749c85eef7b5be836375260855050ee3 (diff)
downloadcpython-31e43cbe5f01cdd5b5ab330ec3040920e8b61a91.zip
cpython-31e43cbe5f01cdd5b5ab330ec3040920e8b61a91.tar.gz
cpython-31e43cbe5f01cdd5b5ab330ec3040920e8b61a91.tar.bz2
bpo-46009: Remove GEN_START (GH-30367)
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c8
-rw-r--r--Python/compile.c21
-rw-r--r--Python/opcode_targets.h8
3 files changed, 8 insertions, 29 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 81bea44..953876f 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2709,14 +2709,6 @@ check_eval_breaker:
return retval;
}
- TARGET(GEN_START) {
- PyObject *none = POP();
- assert(none == Py_None);
- assert(oparg < 3);
- Py_DECREF(none);
- DISPATCH();
- }
-
TARGET(POP_EXCEPT) {
_PyErr_StackItem *exc_info = tstate->exc_info;
PyObject *value = exc_info->exc_value;
diff --git a/Python/compile.c b/Python/compile.c
index 9d37529..3a39075 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1208,8 +1208,6 @@ stack_effect(int opcode, int oparg, int jump)
return 1;
case LIST_TO_TUPLE:
return 0;
- case GEN_START:
- return -1;
case LIST_EXTEND:
case SET_UPDATE:
case DICT_MERGE:
@@ -8028,27 +8026,16 @@ insert_prefix_instructions(struct compiler *c, basicblock *entryblock,
/* Add the generator prefix instructions. */
if (flags & (CO_GENERATOR | CO_COROUTINE | CO_ASYNC_GENERATOR)) {
- int kind;
- if (flags & CO_COROUTINE) {
- kind = 1;
- }
- else if (flags & CO_ASYNC_GENERATOR) {
- kind = 2;
- }
- else {
- kind = 0;
- }
-
- struct instr gen_start = {
- .i_opcode = GEN_START,
- .i_oparg = kind,
+ struct instr pop_top = {
+ .i_opcode = POP_TOP,
+ .i_oparg = 0,
.i_lineno = -1,
.i_col_offset = -1,
.i_end_lineno = -1,
.i_end_col_offset = -1,
.i_target = NULL,
};
- if (insert_instruction(entryblock, 0, &gen_start) < 0) {
+ if (insert_instruction(entryblock, 0, &pop_top) < 0) {
return -1;
}
}
diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h
index a8f1398..e9f1a48 100644
--- a/Python/opcode_targets.h
+++ b/Python/opcode_targets.h
@@ -128,18 +128,18 @@ static void *opcode_targets[256] = {
&&TARGET_DELETE_FAST,
&&TARGET_JUMP_IF_NOT_EG_MATCH,
&&TARGET_STORE_FAST__LOAD_FAST,
- &&TARGET_GEN_START,
- &&TARGET_RAISE_VARARGS,
&&TARGET_LOAD_FAST__LOAD_CONST,
+ &&TARGET_RAISE_VARARGS,
+ &&TARGET_LOAD_CONST__LOAD_FAST,
&&TARGET_MAKE_FUNCTION,
&&TARGET_BUILD_SLICE,
- &&TARGET_LOAD_CONST__LOAD_FAST,
+ &&TARGET_STORE_FAST__STORE_FAST,
&&TARGET_MAKE_CELL,
&&TARGET_LOAD_CLOSURE,
&&TARGET_LOAD_DEREF,
&&TARGET_STORE_DEREF,
&&TARGET_DELETE_DEREF,
- &&TARGET_STORE_FAST__STORE_FAST,
+ &&_unknown_opcode,
&&_unknown_opcode,
&&TARGET_CALL_FUNCTION_EX,
&&_unknown_opcode,