Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

GH-127953: Make line number lookup O(1) regardless of the size of the code object #128350

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 7 commits into from
Jan 21, 2025
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
Next Next commit
Merge branch 'main' into variable-sized-line-cache
  • Loading branch information
markshannon committed Jan 20, 2025
commit a1245e529c103425776368a2090c64cc03e1289f
8 changes: 6 additions & 2 deletions 8 Python/instrumentation.c
Original file line number Diff line number Diff line change
Expand Up @@ -1525,9 +1525,10 @@ initialize_lines(PyCodeObject *code, int bytes_per_entry)
case END_FOR:
case END_SEND:
case RESUME:
case POP_ITER:
/* END_FOR cannot start a line, as it is skipped by FOR_ITER
* END_SEND cannot start a line, as it is skipped by SEND
* RESUME must not be instrumented with INSTRUMENT_LINE */
* RESUME and POP_ITER must not be instrumented with INSTRUMENT_LINE */
markshannon marked this conversation as resolved.
Show resolved Hide resolved
set_original_opcode(line_data, i, 0);
break;
default:
Expand Down Expand Up @@ -1594,7 +1595,10 @@ initialize_lines(PyCodeObject *code, int bytes_per_entry)
}
assert(target >= 0);
if (get_line_delta(line_data, target) != NO_LINE) {
set_original_opcode(line_data, target, _Py_GetBaseCodeUnit(code, target).op.code);
int opcode = _Py_GetBaseCodeUnit(code, target).op.code;
if (opcode != POP_ITER) {
set_original_opcode(line_data, target, opcode);
}
}
}
/* Scan exception table */
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.