Skip to content

Commit c8054b9

Browse files
committed
Clean up TODO
1 parent 6f3bc38 commit c8054b9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Objects/genobject.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -483,15 +483,15 @@ _gen_throw(PyGenObject *gen, int close_on_genexit,
483483
ret = _PyFrame_StackPop((_PyInterpreterFrame *)gen->gi_iframe);
484484
assert(ret == yf);
485485
Py_DECREF(ret);
486+
// XXX: Performing this jump ourselves is awkward and problematic.
487+
// See https://github.com/python/cpython/pull/31968.
486488
/* Termination repetition of SEND loop */
487489
assert(frame->f_lasti >= 0);
490+
_Py_CODEUNIT *code = _PyCode_CODE(gen->gi_code);
488491
/* Backup to SEND */
489-
// XXX: Bad use of f_lasti?
490492
frame->f_lasti--;
491-
_Py_CODEUNIT instruction = _PyCode_CODE(gen->gi_code)[frame->f_lasti];
492-
assert(_Py_OPCODE(instruction) == SEND);
493-
// XXX: This doesn't seem to handle EXTENDED_ARGs:
494-
int jump = _Py_OPARG(instruction);
493+
assert(_Py_OPCODE(code[frame->f_lasti]) == SEND);
494+
int jump = _Py_OPARG(code[frame->f_lasti]);
495495
frame->f_lasti += jump;
496496
if (_PyGen_FetchStopIterationValue(&val) == 0) {
497497
ret = gen_send(gen, val);

0 commit comments

Comments
 (0)