Does anyone have a use case for setting f_lineno from a 'return' event of a yield?

Currently setting f_lineno on a frame from a return trace event is forbidden in all cases except when the return is from a yield. This is presumably because in the other cases (return, raise) we are not going to return to the frame, and in the case of the yield we are. So setting the line number would impact where the frame will start executing from when we next return to it. (Depending on what instruction you jump to, it might even work sometimes).

It looks like a feature that was implemented just because we can, but now we are making changes that will require some work to keep it working, and I’m wondering if it’s worth keeping.

Does anyone have a use case for this?

1 Like