mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-133371: Don't optimize LOAD_FAST
instructions whose local is killed by DELETE_FAST
(#133383)
In certain cases it's possible for locals loaded by `LOAD_FAST` instructions to be on the stack when the local is killed by `DEL_FAST`. These `LOAD_FAST` instructions should not be optimized into `LOAD_FAST_BORROW` as the strong reference in the frame is killed while there is still a reference on the stack.
This commit is contained in:
parent
2bbcaedb75
commit
78adb63ee1
3 changed files with 31 additions and 1 deletions
|
@ -2795,6 +2795,11 @@ optimize_load_fast(cfg_builder *g)
|
|||
assert(opcode != EXTENDED_ARG);
|
||||
switch (opcode) {
|
||||
// Opcodes that load and store locals
|
||||
case DELETE_FAST: {
|
||||
kill_local(instr_flags, &refs, oparg);
|
||||
break;
|
||||
}
|
||||
|
||||
case LOAD_FAST: {
|
||||
PUSH_REF(i, oparg);
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue