8000 bpo-42823: Fix frame lineno when frame.f_trace is set by markshannon · Pull Request #24099 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-42823: Fix frame lineno when frame.f_trace is set #24099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 5, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Clarify logic about what instructions to line trace.
  • Loading branch information
markshannon committed Jan 5, 2021
commit 5028a2e1183fb3c8193e77242c517a745d1b4f58
7 changes: 5 additions & 2 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -5000,8 +5000,11 @@ maybe_call_line_trace(Py_tracefunc func, PyObject *obj,
*/
int lastline = bounds->ar_line;
int line = _PyCode_CheckLineNumber(frame->f_lasti, bounds);
if (frame->f_lasti < *instr_prev || (line != lastline && frame->f_lasti == bounds->ar_start)) {
if (line != -1 && frame->f_trace_lines) {
if (line != -1 && frame->f_trace_lines) {
/* Trace backward edges or first instruction of a new line */
if (frame->f_lasti < *instr_prev ||
(line != lastline && frame->f_lasti == bounds->ar_start))
{
frame->f_lineno = line;
result = call_trace(func, obj, tstate, frame, PyTrace_LINE, Py_None);
frame->f_lineno = 0;
Expand Down
0