Skip to content

Commit 172a013

Browse files
committed
Remove YIELD_FROM opcode.
1 parent e056334 commit 172a013

File tree

5 files changed

+13
-78
lines changed

5 files changed

+13
-78
lines changed

Include/opcode.h

Lines changed: 9 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Lib/opcode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def jabs_op(name, op):
9393
def_op('GET_YIELD_FROM_ITER', 69)
9494
def_op('PRINT_EXPR', 70)
9595
def_op('LOAD_BUILD_CLASS', 71)
96-
def_op('YIELD_FROM', 72)
96+
9797
def_op('GET_AWAITABLE', 73)
9898
def_op('LOAD_ASSERTION_ERROR', 74)
9999

Python/ceval.c

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -2625,68 +2625,6 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
26252625
DISPATCH();
26262626
}
26272627

2628-
TARGET(YIELD_FROM) {
2629-
assert(frame->depth == 0);
2630-
PyObject *v = POP();
2631-
PyObject *receiver = TOP();
2632-
PySendResult gen_status;
2633-
PyObject *retval;
2634-
if (tstate->c_tracefunc == NULL) {
2635-
gen_status = PyIter_Send(receiver, v, &retval);
2636-
} else {
2637-
_Py_IDENTIFIER(send);
2638-
if (Py_IsNone(v) && PyIter_Check(receiver)) {
2639-
retval = Py_TYPE(receiver)->tp_iternext(receiver);
2640-
}
2641-
else {
2642-
retval = _PyObject_CallMethodIdOneArg(receiver, &PyId_send, v);
2643-
}
2644-
if (retval == NULL) {
2645-
if (tstate->c_tracefunc != NULL
2646-
&& _PyErr_ExceptionMatches(tstate, PyExc_StopIteration))
2647-
call_exc_trace(tstate->c_tracefunc, tstate->c_traceobj, tstate, frame);
2648-
if (_PyGen_FetchStopIterationValue(&retval) == 0) {
2649-
gen_status = PYGEN_RETURN;
2650-
}
2651-
else {
2652-
gen_status = PYGEN_ERROR;
2653-
}
2654-
}
2655-
else {
2656-
gen_status = PYGEN_NEXT;
2657-
}
2658-
}
2659-
Py_DECREF(v);
2660-
if (gen_status == PYGEN_ERROR) {
2661-
assert (retval == NULL);
2662-
goto error;
2663-
}
2664-
if (gen_status == PYGEN_RETURN) {
2665-
assert (retval != NULL);
2666-
2667-
Py_DECREF(receiver);
2668-
SET_TOP(retval);
2669-
retval = NULL;
2670-
DISPATCH();
2671-
}
2672-
assert (gen_status == PYGEN_NEXT);
2673-
/* receiver remains on stack, retval is value to be yielded */
2674-
/* and repeat... */
2675-
assert(frame->f_lasti > 0);
2676-
frame->f_lasti -= 1;
2677-
frame->f_state = FRAME_SUSPENDED;
2678-
_PyFrame_SetStackPointer(frame, stack_pointer);
2679-
TRACE_FUNCTION_EXIT();
2680-
DTRACE_FUNCTION_EXIT();
2681-
_Py_LeaveRecursiveCall(tstate);
2682-
/* Restore previous cframe and return. */
2683-
tstate->cframe = cframe.previous;
2684-
tstate->cframe->use_tracing = cframe.use_tracing;
2685-
assert(tstate->cframe->current_frame == frame->previous);
2686-
assert(!_PyErr_Occurred(tstate));
2687-
return retval;
2688-
}
2689-
26902628
TARGET(SEND) {
26912629
assert(frame->depth == 0);
26922630
assert(STACK_LEVEL() >= 2);

Python/compile.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,8 +1044,6 @@ stack_effect(int opcode, int oparg, int jump)
10441044
return 0;
10451045
case YIELD_VALUE:
10461046
return 0;
1047-
case YIELD_FROM:
1048-
return -1;
10491047
case POP_BLOCK:
10501048
return 0;
10511049
case POP_EXCEPT:

Python/opcode_targets.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)