Mark Shannon <m...@hotpy.org> added the comment:

Are you using `f_lasti == -1` as a proxy for "is this an actual call or a 
resumption after a yield"?

Ultimately PEP 669 will provide all the information you could need to 
differentiate different events.

In the meantime...

We now make all "call" events explicit in the bytecode using the new RESUME 
instruction.

That means the following is true for *all* call events:
  f_lasti >= 0
  code.co_code[f_lasti*2] == opcode.opmap["RESUME"]

The oparg of the RESUME instruction describes the kind of "call" event.
Given `oparg = code.co_code[f_lasti*2+1]`, then
`oparg == 0` implies that the event is an actual call.

See https://docs.python.org/3.11/library/dis.html#opcode-RESUME


Does that help?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46225>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to