There was an error while loading. Please reload this page.
1 parent fc36be1 commit e1091e0Copy full SHA for e1091e0
1 file changed
Python/ceval.c
@@ -1372,6 +1372,7 @@ eval_frame_handle_pending(PyThreadState *tstate)
1372
opcode = _Py_OPCODE(word); \
1373
if (opcode == op) { \
1374
oparg = _Py_OPARG(word); \
1375
+ frame->f_lasti = INSTR_OFFSET(); \
1376
next_instr++; \
1377
goto PREDICT_ID(op); \
1378
} \
@@ -1615,12 +1616,10 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr
1615
1616
multiple values.
1617
1618
When the PREDICT() macros are enabled, some opcode pairs follow in
- direct succession without updating frame->f_lasti. A successful
1619
- prediction effectively links the two codes together as if they
1620
- were a single new opcode; accordingly,frame->f_lasti will point to
1621
- the first code in the pair (for instance, GET_ITER followed by
1622
- FOR_ITER is effectively a single opcode and frame->f_lasti will point
1623
- to the beginning of the combined pair.)
+ direct succession. A successful prediction effectively links the two
+ codes together as if they were a single new opcode, but the value
+ of frame->f_lasti is correctly updated so potential inlined calls
+ or lookups of frame->f_lasti are aways correct when the macros are used.
1624
*/
1625
assert(frame->f_lasti >= -1);
1626
_Py_CODEUNIT *next_instr = first_instr + frame->f_lasti + 1;
0 commit comments