Skip to content

Commit

Permalink
Handle STORE_DEREF formatting like any other store
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Jul 1, 2024
1 parent 5197bc0 commit 82d85dd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion xdis/opcodes/format/extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def extended_format_store_op(opc, instructions: list) -> Tuple[str, Optional[int
argval = get_instruction_arg(prev_inst, argval)
start_offset = prev_inst.start_offset
if prev_inst.opname.startswith("INPLACE_"):
# Inplace operators show their own assign
# Inplace operators have their own assign routine.
return argval, start_offset
return f"{inst.argval} = {argval}", start_offset

Expand Down Expand Up @@ -753,6 +753,7 @@ def skip_cache(instructions: list, i: int) -> int:
"RAISE_VARARGS": extended_format_RAISE_VARARGS_older,
"RETURN_VALUE": extended_format_RETURN_VALUE,
"STORE_ATTR": extended_format_ATTR,
"STORE_DEREF": extended_format_store_op,
"STORE_FAST": extended_format_store_op,
"STORE_GLOBAL": extended_format_store_op,
"STORE_NAME": extended_format_store_op,
Expand Down
1 change: 1 addition & 0 deletions xdis/opcodes/opcode_310graal.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def def_graal_op(
# cellvars or freevars array ({@code co_cellvars}, {@code
# co_freevars}).
# Pops: value to be written into the cell contents
# FIXME: this should be tagged as both a "free" and as "store" op.
def_graal_op(opc, "STORE_DEREF", 34, 1, 1, 0)

# Deletes a local cell variable determined by the immediate operand
Expand Down
3 changes: 2 additions & 1 deletion xdis/opcodes/opcode_311.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
init_opdata,
jrel_op,
rm_op,
store_op,
update_pj3,
)
from xdis.opcodes.format.extended import extended_format_binary_op
Expand Down Expand Up @@ -160,7 +161,7 @@
def_op(loc, "GET_AWAITABLE", 131, 0, 0)
def_op(loc, "LOAD_CLOSURE", 136, 0, 1)
def_op(loc, "LOAD_DEREF", 137, 0, 1)
def_op(loc, "STORE_DEREF", 138, 1, 0)
store_op(loc, "STORE_DEREF", 138, 1, 0, is_type="free")
def_op(loc, "DELETE_DEREF", 139, 0, 0)

# These are added since 3.10...
Expand Down

0 comments on commit 82d85dd

Please sign in to comment.