Skip to content
Closed
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
Next Next commit
call PyFrame_GetLineNumber() in maybe_dtrace_line() only when needed
  • Loading branch information
xdegaye committed Mar 25, 2018
commit 32e6a2cbeeb633111773aeaad470c17cdfe0f36f
8 changes: 4 additions & 4 deletions Python/ceval.c
Original file line number Diff line number Diff line change
Expand Up @@ -5094,7 +5094,7 @@ static void
maybe_dtrace_line(PyFrameObject *frame,
int *instr_lb, int *instr_ub, int *instr_prev)
{
int line;
int line = -1;
const char *co_filename, *co_name;

/* If the last instruction executed isn't in the current
Expand All @@ -5106,14 +5106,14 @@ maybe_dtrace_line(PyFrameObject *frame,
&bounds);
*instr_lb = bounds.ap_lower;
*instr_ub = bounds.ap_upper;
} else {
line = PyFrame_GetLineNumber(frame);
}

/* If the last instruction falls at the start of a line or if
it represents a jump backwards, update the frame's line
number and call the trace function. */
if (frame->f_lasti == *instr_lb || frame->f_lasti < *instr_prev) {
if (line == -1) {
line = PyFrame_GetLineNumber(frame);
}
co_filename = PyUnicode_AsUTF8(frame->f_code->co_filename);
if (!co_filename)
co_filename = "?";
Expand Down