Skip to content

Commit

Permalink
mark STORE_FAST_MAYBE_NULL as possibly NULLing a local
Browse files Browse the repository at this point in the history
Given the current usage of STORE_FAST_MAYBE_NULL, it isn't possible to
construct a repro where this is needed, because if the local was NULL
coming into the comprehension it will already be marked as unsafe coming
out of the comprehension (since the body of the comprehension is always
a loop which may be skipped entirely). But in case this opcode is used
in other contexts in future, it should mark the local unsafe.
  • Loading branch information
carljm committed Feb 10, 2023
1 parent 17d5d84 commit b87d209
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Python/compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -7996,6 +7996,7 @@ scan_block_for_locals(basicblock *b, basicblock ***sp)
switch (instr->i_opcode) {
case DELETE_FAST:
case LOAD_FAST_AND_CLEAR:
case STORE_FAST_MAYBE_NULL:
unsafe_mask |= bit;
break;
case STORE_FAST:
Expand Down Expand Up @@ -8050,6 +8051,7 @@ fast_scan_many_locals(basicblock *entryblock, int nlocals)
switch (instr->i_opcode) {
case DELETE_FAST:
case LOAD_FAST_AND_CLEAR:
case STORE_FAST_MAYBE_NULL:
states[arg - 64] = blocknum - 1;
break;
case STORE_FAST:
Expand Down

0 comments on commit b87d209

Please sign in to comment.