bpo-24565: f->f_lineno is now -1 when tracing is not set#6233
bpo-24565: f->f_lineno is now -1 when tracing is not set#6233xdegaye wants to merge 2 commits intopython:masterfrom xdegaye:bpo-24565
Conversation
When tracing is set, f->f_lineno is valid for all the frames of the stack except upon starting or resuming a frame where it is -1 until the first call to maybe_call_line_trace(). Fix issues 7238, 16482, 17277 and 17697.
|
The PR introduces a behavior change: upon resuming a generator frame, it is not possible anymore to jump from a call trace event. This is a minor change as the jump may be done from the first line event without changing anything, and actually it can be considered as a fix as it is more consistent to forbid jumps from all call events and not only for new frames as previously. I have checked that all the faulty use cases in issues 7238, 16482, 17277 and 17697 are ok now with this PR, and that the tests added by the PR (except |
Python/ceval.c
Outdated
| *instr_lb = bounds.ap_lower; | ||
| *instr_ub = bounds.ap_upper; | ||
| } else { | ||
| line = PyFrame_GetLineNumber(frame); |
There was a problem hiding this comment.
When dtrace is active and a trace function is unset, f->f_lineno is set to -1 on all the frames on the stack and this is why we cannot use directly f->f_lineno in maybe_dtrace_line() and why the current line number must be obtained from PyFrame_GetLineNumber() instead. However the call to PyFrame_GetLineNumber() is only needed when PyDTrace_LINE() is called.
I will fix that in the next commit.
|
Thank you for working on this! /cc @antocuni |
|
Is there anything I could help to move this forward? |
|
Added links to BPO issues. |
|
@serhiy-storchaka, what would be needed to move this forward? |
|
Yeah, it's a real pity to not have this in 3.7 really. Do you think it could go into 3.7.x, or does it have to wait for 3.8? (which I assume) |
|
Can you resolve the conflict, please? |
Since this is a change in behavior, it won't go into 3.7.x. (@blueyed has already mentioned a 3rd party library that this change would likely affect.) |
|
@serhiy-storchaka, ping? |
|
Closing this PR as it is from PR #12419 is the continuation of this PR with the pending conflict resolved. |
When tracing is set, f->f_lineno is valid for all the frames of the
stack except upon starting or resuming a frame where it is -1 until
the first call to maybe_call_line_trace().
Fix issues 7238, 16482, 17277 and 17697.
https://bugs.python.org/issue24565