mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Add new PyFrame_GetLasti C-API function (GH-32413)
This commit is contained in:
parent
f4b328e2bb
commit
5b4a4b6f09
7 changed files with 45 additions and 4 deletions
|
@ -880,7 +880,7 @@ _PyFrame_OpAlreadyRan(_PyInterpreterFrame *frame, int opcode, int oparg)
|
|||
// This only works when opcode is a non-quickened form:
|
||||
assert(_PyOpcode_Deopt[opcode] == opcode);
|
||||
int check_oparg = 0;
|
||||
for (_Py_CODEUNIT *instruction = _PyCode_CODE(frame->f_code);
|
||||
for (_Py_CODEUNIT *instruction = _PyCode_CODE(frame->f_code);
|
||||
instruction < frame->prev_instr; instruction++)
|
||||
{
|
||||
int check_opcode = _PyOpcode_Deopt[_Py_OPCODE(*instruction)];
|
||||
|
@ -1135,6 +1135,16 @@ PyFrame_GetBuiltins(PyFrameObject *frame)
|
|||
return frame_getbuiltins(frame, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
PyFrame_GetLasti(PyFrameObject *frame)
|
||||
{
|
||||
int lasti = _PyInterpreterFrame_LASTI(frame->f_frame);
|
||||
if (lasti < 0) {
|
||||
return -1;
|
||||
}
|
||||
return lasti*2;
|
||||
}
|
||||
|
||||
PyObject *
|
||||
PyFrame_GetGenerator(PyFrameObject *frame)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue