This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add `f_state` attribute to FrameObjects.
Type: Stage:
Components: Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Mark.Shannon, brandtbucher, nedbat
Priority: normal Keywords:

Created on 2022-03-17 16:40 by Mark.Shannon, last changed 2022-04-11 14:59 by admin.

Messages (3)
msg415427 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2022-03-17 16:40
When tracing, the event supplied is insufficient to determine what is actually happening.

E.g. A "call" event could be a call to a function or resuming a generator or coroutine.

Adding a state field to the FrameObject would allow these cases to be disambiguated without having to make dubious deductions from `f_lasti` or other frame attributes.

The proposed states would be:

FRAME_CREATED    # Frame created, but not executed at all
FRAME_SUSPENDED  # Frame suspended after yield or yield from
FRAME_EXECUTING  # Frame is executed normally
FRAME_COMPLETED  # Frame has completed 
FRAME_CLEARED    # Frame has been cleared


Ned, any other states that you might need to know about?
msg415456 - (view) Author: Ned Batchelder (nedbat) * (Python triager) Date: 2022-03-17 23:03
These look great.  Currently, coverage.py only tries to distinguish between return/yield, which I guess will now be COMPLETED and SUSPENDED?
msg416978 - (view) Author: Mark Shannon (Mark.Shannon) * (Python committer) Date: 2022-04-08 11:36
Don't you need to know if a "call" event is a call or the resumption of a generator?
History
Date User Action Args
2022-04-11 14:59:57adminsetgithub: 91202
2022-04-08 11:36:06Mark.Shannonsetmessages: + msg416978
2022-03-17 23:03:14nedbatsetmessages: + msg415456
2022-03-17 20:11:28brandtbuchersetnosy: + brandtbucher
2022-03-17 16:40:39Mark.Shannoncreate