Skip to content

gh-152600: Remove LOAD_FAST/LOAD_FAST_BORROW; POP_TOP pairs#152643

Open
brijkapadia wants to merge 3 commits into
python:mainfrom
brijkapadia:load-fast-pop-top
Open

gh-152600: Remove LOAD_FAST/LOAD_FAST_BORROW; POP_TOP pairs#152643
brijkapadia wants to merge 3 commits into
python:mainfrom
brijkapadia:load-fast-pop-top

Conversation

@brijkapadia

@brijkapadia brijkapadia commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Changes:

  • moved add_checks_for_loads_of_uninitialized_variables earlier so that a LOAD_FAST that should be a LOAD_FAST_CHECK is not removed.
  • refactored remove_redundant_nops_and_pairs to be more concise. Also extended it so that any COPY gets removed. I don't think there is any reason to only remove COPY with an oparg of 1.

I don't think a NEWS entry is needed.

Changes
- moved `add_checks_for_loads_of_uninitialized_variables` earlier so
  that a `LOAD_FAST` that should be a `LOAD_FAST_CHECK` are not removed.
- refactored `remove_redundant_nops_and_pairs` to be more concise. Also
  extended it so that any `COPY` gets removed. I don't think there is
  any reason to only remove `COPY` with an `oparg` of 1.

I don't think a NEWS entry is needed.
@brijkapadia brijkapadia marked this pull request as ready for review June 30, 2026 01:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant