mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-46841: Don't scan backwards in bytecode (GH-31901)
This commit is contained in:
parent
a4674f0194
commit
49e1e1e1bd
2 changed files with 12 additions and 15 deletions
|
@ -359,9 +359,12 @@ _PyGen_yf(PyGenObject *gen)
|
|||
assert(code[0] != SEND);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (code[(frame->f_lasti-1)*sizeof(_Py_CODEUNIT)] != SEND || frame->stacktop < 0)
|
||||
int opcode = code[(frame->f_lasti+1)*sizeof(_Py_CODEUNIT)];
|
||||
int oparg = code[(frame->f_lasti+1)*sizeof(_Py_CODEUNIT)+1];
|
||||
if (opcode != RESUME || oparg < 2) {
|
||||
/* Not in a yield from */
|
||||
return NULL;
|
||||
}
|
||||
yf = _PyFrame_StackPeek(frame);
|
||||
Py_INCREF(yf);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue