How to use the xdis.opcodes.base.store_op function in xdis

To help you get started, we’ve selected a few xdis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rocky / python-xdis / xdis / opcodes / opcode_3x.py View on Github external
def_op(l, 'BINARY_MODULO',        22,  2,  1)
def_op(l, 'BINARY_ADD',           23,  2,  1)
def_op(l, 'BINARY_SUBTRACT',      24,  2,  1)
def_op(l, 'BINARY_SUBSCR',        25,  2,  1)
def_op(l, 'BINARY_FLOOR_DIVIDE',  26,  2,  1)
def_op(l, 'BINARY_TRUE_DIVIDE',   27,  2,  1)
def_op(l, 'INPLACE_FLOOR_DIVIDE', 28,  2,  1)
def_op(l, 'INPLACE_TRUE_DIVIDE',  29,  2,  1)

# Gone from Python 3 are Python2's
# SLICE+0 .. SLICE+3
# STORE_SLICE+0 .. STORE_SLICE+3
# DELETE_SLICE+0 .. DELETE_SLICE+3

store_op(l, 'STORE_MAP',            54,  3,  1)
def_op(l, 'INPLACE_ADD',          55,  2,  1)
def_op(l, 'INPLACE_SUBTRACT',     56,  2,  1)
def_op(l, 'INPLACE_MULTIPLY',     57,  2,  1)

def_op(l, 'INPLACE_MODULO',       59,  2,  1)
store_op(l, 'STORE_SUBSCR',         60,  3,  0) # Implements TOS1[TOS] = TOS2.
def_op(l, 'DELETE_SUBSCR',        61,  2,  0) # Implements del TOS1[TOS].
def_op(l, 'BINARY_LSHIFT',        62,  2,  1)
def_op(l, 'BINARY_RSHIFT',        63,  2,  1)
def_op(l, 'BINARY_AND',           64,  2,  1)
def_op(l, 'BINARY_XOR',           65,  2,  1)
def_op(l, 'BINARY_OR',            66,  2,  1)
def_op(l, 'INPLACE_POWER',        67,  2,  1)
def_op(l, 'GET_ITER',             68,  1,  1)
store_op(l, 'STORE_LOCALS',         69,  1,  0)
github rocky / python-xdis / xdis / opcodes / opcode_2x.py View on Github external
store_op(l, "STORE_SLICE+0",        40,  2,  0)
store_op(l, "STORE_SLICE+1",        41,  3,  0)
store_op(l, "STORE_SLICE+2",        42,  3,  0)
store_op(l, "STORE_SLICE+3",        43,  4,  0)

def_op(l, "DELETE_SLICE+0",       50,  1,  0)
def_op(l, "DELETE_SLICE+1",       51,  2,  0)
def_op(l, "DELETE_SLICE+2",       52,  2,  0)
def_op(l, "DELETE_SLICE+3",       53,  3,  0)

def_op(l, "INPLACE_ADD",          55,  2,  1)
def_op(l, "INPLACE_SUBTRACT",     56,  2,  1)
def_op(l, "INPLACE_MULTIPLY",     57,  2,  1)
def_op(l, "INPLACE_DIVIDE",       58,  2,  1)
def_op(l, "INPLACE_MODULO",       59,  2,  1)
store_op(l, "STORE_SUBSCR",       60,  3,  0) # Implements TOS1[TOS] = TOS2.
def_op(l, "DELETE_SUBSCR",        61,  2,  0) # Implements del TOS1[TOS].

def_op(l, "BINARY_LSHIFT",        62,  2,  1)
def_op(l, "BINARY_RSHIFT",        63,  2,  1)
def_op(l, "BINARY_AND",           64,  2,  1)
def_op(l, "BINARY_XOR",           65,  2,  1)
def_op(l, "BINARY_OR",            66,  2,  1)
def_op(l, "INPLACE_POWER",        67,  2,  1)
def_op(l, "GET_ITER",             68,  1,  1)

def_op(l, "PRINT_EXPR",           70,  1,  0)
def_op(l, "PRINT_ITEM",           71,  1,  0)
def_op(l, "PRINT_NEWLINE",        72,  0,  0)
def_op(l, "PRINT_ITEM_TO",        73,  2,  0)
def_op(l, "PRINT_NEWLINE_TO",     74,  1,  0)
def_op(l, "INPLACE_LSHIFT",       75,  2,  1)
github rocky / python-xdis / xdis / opcodes / opcode_15.py View on Github external
def_op(l, "SLICE+0", 30, 1, 1)
def_op(l, "SLICE+1", 31, 2, 1)
def_op(l, "SLICE+2", 32, 2, 1)
def_op(l, "SLICE+3", 33, 3, 1)

store_op(l, "STORE_SLICE+0", 40, 2, 0)
store_op(l, "STORE_SLICE+1", 41, 3, 0)
store_op(l, "STORE_SLICE+2", 42, 3, 0)
store_op(l, "STORE_SLICE+3", 43, 4, 0)

def_op(l, "DELETE_SLICE+0", 50, 1, 0)
def_op(l, "DELETE_SLICE+1", 51, 2, 0)
def_op(l, "DELETE_SLICE+2", 52, 2, 0)
def_op(l, "DELETE_SLICE+3", 53, 3, 0)

store_op(l, "STORE_SUBSCR", 60, 3, 0)  # Implements TOS1[TOS] = TOS2.
def_op(l, "DELETE_SUBSCR", 61, 2, 0)  # Implements del TOS1[TOS].

def_op(l, "BINARY_LSHIFT", 62, 2, 1)
def_op(l, "BINARY_RSHIFT", 63, 2, 1)
def_op(l, "BINARY_AND", 64, 2, 1)
def_op(l, "BINARY_XOR", 65, 2, 1)
def_op(l, "BINARY_OR", 66, 2, 1)

def_op(l, "PRINT_EXPR", 70, 1, 0)
def_op(l, "PRINT_ITEM", 71, 1, 0)
def_op(l, "PRINT_NEWLINE", 72, 0, 0)

def_op(l, "BREAK_LOOP", 80, 0, 0, fallthrough=False)

def_op(l, "LOAD_LOCALS", 82, 0, 1)
def_op(l, "RETURN_VALUE", 83, 1, 0, fallthrough=False)
github rocky / python-xdis / xdis / opcodes / opcode_3x.py View on Github external
def_op(l, 'INPLACE_OR',           79,  2,  1)
def_op(l, 'BREAK_LOOP',           80,  0,  0, fallthrough=False)
def_op(l, 'WITH_CLEANUP',         81,  1,  0) # Cleans up the stack when a with statement
                                              # block exits.  Handle stack special

def_op(l, 'RETURN_VALUE',         83,  1,  0, fallthrough=False)
def_op(l, 'IMPORT_STAR',          84,  1,  0)

def_op(l, 'YIELD_VALUE',          86,  1,  1)
def_op(l, 'POP_BLOCK',            87,  0,  0)
def_op(l, 'END_FINALLY',          88,  1,  0)
def_op(l, 'POP_EXCEPT',           89,  0,  0)

HAVE_ARGUMENT = 90              # Opcodes from here have an argument:

store_op(l, 'STORE_NAME',           90,  1,  0, is_type="name")   # Operand is in name list
name_op(l, 'DELETE_NAME',           91,  0,  0)   # ""
varargs_op(l, 'UNPACK_SEQUENCE',    92,  0, -1)  # unpacks TOS, arg is the count
jrel_op(l,    'FOR_ITER',           93,  0,  1)

varargs_op(l, 'UNPACK_EX',          94,  0,  0)  # assignment with a starred target; arg is count
store_op(l, 'STORE_ATTR',           95,  2,  0, is_type="name")   # Operand is in name list
name_op(l, 'DELETE_ATTR',           96,  1,  0)   # ""
store_op(l, 'STORE_GLOBAL',         97,  1,  0, is_type="name")   # ""
name_op(l, 'DELETE_GLOBAL',         98,  0,  0)   # ""

# Python 2's DUP_TOPX is gone starting in Python 3.2

const_op(l,   'LOAD_CONST',        100,  0,  1)  # Operand is in const list
name_op(l,    'LOAD_NAME',         101,  0,  1)  # Operand is in name list
varargs_op(l, 'BUILD_TUPLE',       102, -1,  1)  # TOS is count of tuple items
varargs_op(l, 'BUILD_LIST',        103, -1,  1)  # TOS is count of list items
github rocky / python-xdis / xdis / opcodes / opcode_3x.py View on Github external
def_op(l, 'BINARY_TRUE_DIVIDE',   27,  2,  1)
def_op(l, 'INPLACE_FLOOR_DIVIDE', 28,  2,  1)
def_op(l, 'INPLACE_TRUE_DIVIDE',  29,  2,  1)

# Gone from Python 3 are Python2's
# SLICE+0 .. SLICE+3
# STORE_SLICE+0 .. STORE_SLICE+3
# DELETE_SLICE+0 .. DELETE_SLICE+3

store_op(l, 'STORE_MAP',            54,  3,  1)
def_op(l, 'INPLACE_ADD',          55,  2,  1)
def_op(l, 'INPLACE_SUBTRACT',     56,  2,  1)
def_op(l, 'INPLACE_MULTIPLY',     57,  2,  1)

def_op(l, 'INPLACE_MODULO',       59,  2,  1)
store_op(l, 'STORE_SUBSCR',         60,  3,  0) # Implements TOS1[TOS] = TOS2.
def_op(l, 'DELETE_SUBSCR',        61,  2,  0) # Implements del TOS1[TOS].
def_op(l, 'BINARY_LSHIFT',        62,  2,  1)
def_op(l, 'BINARY_RSHIFT',        63,  2,  1)
def_op(l, 'BINARY_AND',           64,  2,  1)
def_op(l, 'BINARY_XOR',           65,  2,  1)
def_op(l, 'BINARY_OR',            66,  2,  1)
def_op(l, 'INPLACE_POWER',        67,  2,  1)
def_op(l, 'GET_ITER',             68,  1,  1)
store_op(l, 'STORE_LOCALS',         69,  1,  0)

def_op(l, 'PRINT_EXPR',           70,  1,  0)
def_op(l, 'LOAD_BUILD_CLASS',     71,  0,  1)

# Python3 drops/changes:
#  def_op(l, 'PRINT_ITEM', 71)
#  def_op(l, 'PRINT_NEWLINE', 72)
github rocky / python-xdis / xdis / opcodes / opcode_3x.py View on Github external
local_op(l, 'LOAD_FAST',           124,  0,  1)  # Local variable number
store_op(l, 'STORE_FAST',          125,  1,  0, is_type="local")  # Local variable number
local_op(l, 'DELETE_FAST',         126,  0,  0)  # Local variable number

nargs_op(l, 'RAISE_VARARGS',       130, -1,  1, fallthrough=False)
                                                 # Number of raise arguments (1, 2, or 3)
nargs_op(l, 'CALL_FUNCTION',       131, -1,  1)  # #args + (#kwargs << 8)

nargs_op(l, 'MAKE_FUNCTION',       132, -2,  1) # TOS is number of args if < 3.6
varargs_op(l, 'BUILD_SLICE',       133,  2,  1) # TOS is number of items to pop

nargs_op(l, 'MAKE_CLOSURE',        134, -3,  1) # TOS is number of items to pop
free_op(l, 'LOAD_CLOSURE',         135,  0,  1)
free_op(l, 'LOAD_DEREF',           136,  0,  1)
store_op(l, 'STORE_DEREF',         137,  1,  0, is_type="free")
free_op(l, 'DELETE_DEREF',         138,  0,  0)

nargs_op(l, 'CALL_FUNCTION_VAR',   140,  -2,  1)  # #args + (#kwargs << 8)
nargs_op(l, 'CALL_FUNCTION_KW',    141,  -2,  1)  # #args + (#kwargs << 8)
nargs_op(l, 'CALL_FUNCTION_VAR_KW',142,  -3,  1)   # #args + (#kwargs << 8)

jrel_op(l, 'SETUP_WITH',           143,  0,  7)

def_op(l, 'LIST_APPEND',           145,  2,  1)  # Calls list.append(TOS[-i], TOS).
                                                 # Used to implement list comprehensions.
def_op(l, 'SET_ADD',               146,  1,  0)  # Calls set.add(TOS1[-i], TOS).
                                                 # Used to implement set comprehensions.
def_op(l, 'MAP_ADD',               147,  3,  1)  # Calls dict.setitem(TOS1[-i], TOS, TOS1)
                                                 # Used to implement dict comprehensions.

def_op(l, 'EXTENDED_ARG',          144,  0,   0)
github rocky / python-xdis / xdis / opcodes / opcode_3x.py View on Github external
def_op(l, 'IMPORT_STAR',          84,  1,  0)

def_op(l, 'YIELD_VALUE',          86,  1,  1)
def_op(l, 'POP_BLOCK',            87,  0,  0)
def_op(l, 'END_FINALLY',          88,  1,  0)
def_op(l, 'POP_EXCEPT',           89,  0,  0)

HAVE_ARGUMENT = 90              # Opcodes from here have an argument:

store_op(l, 'STORE_NAME',           90,  1,  0, is_type="name")   # Operand is in name list
name_op(l, 'DELETE_NAME',           91,  0,  0)   # ""
varargs_op(l, 'UNPACK_SEQUENCE',    92,  0, -1)  # unpacks TOS, arg is the count
jrel_op(l,    'FOR_ITER',           93,  0,  1)

varargs_op(l, 'UNPACK_EX',          94,  0,  0)  # assignment with a starred target; arg is count
store_op(l, 'STORE_ATTR',           95,  2,  0, is_type="name")   # Operand is in name list
name_op(l, 'DELETE_ATTR',           96,  1,  0)   # ""
store_op(l, 'STORE_GLOBAL',         97,  1,  0, is_type="name")   # ""
name_op(l, 'DELETE_GLOBAL',         98,  0,  0)   # ""

# Python 2's DUP_TOPX is gone starting in Python 3.2

const_op(l,   'LOAD_CONST',        100,  0,  1)  # Operand is in const list
name_op(l,    'LOAD_NAME',         101,  0,  1)  # Operand is in name list
varargs_op(l, 'BUILD_TUPLE',       102, -1,  1)  # TOS is count of tuple items
varargs_op(l, 'BUILD_LIST',        103, -1,  1)  # TOS is count of list items
varargs_op(l, 'BUILD_SET',         104, -1,  1)  # TOS is count of set items
def_op(l, 'BUILD_MAP',             105,  0,  1)  # argument is dictionary count to be pushed
name_op(l, 'LOAD_ATTR',            106,  1,  1)  # Operand is in name list
compare_op(l, 'COMPARE_OP',        107,  2,  1)  # Comparison operator
name_op(l, 'IMPORT_NAME',          108,  2,  1)  # Imports TOS and TOS1; module pushed
name_op(l, 'IMPORT_FROM',          109,  0,  1)  # Operand is in name list
github rocky / python-xdis / xdis / opcodes / opcode_15.py View on Github external
def_op(l, "EXEC_STMT", 85, 3, 0)

def_op(l, "POP_BLOCK", 87, 0, 0)
def_op(l, "END_FINALLY", 88, 1, 0)
def_op(l, "BUILD_CLASS", 89, 3, 0)

# HAVE_ARGUMENT = 90               # Opcodes from here have an argument:

store_op(l, "STORE_NAME", 90, 1, 0, is_type="name")  # Operand is in name list
name_op(l, "DELETE_NAME", 91, 0, 0)  # ""
varargs_op(l, "UNPACK_TUPLE", 92)  # Number of tuple items
def_op(l, "UNPACK_LIST", 93)  # Number of list items
store_op(l, "STORE_ATTR", 95, 2, 0, is_type="name")  # Operand is in name list
name_op(l, "DELETE_ATTR", 96, 1, 0)  # ""
store_op(l, "STORE_GLOBAL", 97, 1, 0, is_type="name")  # ""
name_op(l, "DELETE_GLOBAL", 98, 0, 0)  # ""

const_op(l, "LOAD_CONST", 100, 0, 1)  # Operand is in const list
name_op(l, "LOAD_NAME", 101, 0, 1)  # Operand is in name list
varargs_op(l, "BUILD_TUPLE", 102, -1, 1)  # Number of tuple items
varargs_op(l, "BUILD_LIST", 103, -1, 1)  # Number of list items
varargs_op(l, "BUILD_MAP", 104, -1, 1)  # Always zero for now
name_op(l, "LOAD_ATTR", 105, 1, 1)  # Operand is in name list
compare_op(l, "COMPARE_OP", 106, 2, 1)  # Comparison operator

name_op(l, "IMPORT_NAME", 107, 2, 1)  # Operand is in name list
name_op(l, "IMPORT_FROM", 108, 0, 1)  # Operand is in name list

jrel_op(l, "JUMP_FORWARD", 110, 0, 0, fallthrough=False)  # Number of bytes to skip
jrel_op(l, "JUMP_IF_FALSE", 111, 1, 1, True)  # ""
jrel_op(l, "JUMP_IF_TRUE", 112, 1, 1, True)  # ""
github rocky / python-xdis / xdis / opcodes / opcode_15.py View on Github external
def_op(l, "LOAD_LOCALS", 82, 0, 1)
def_op(l, "RETURN_VALUE", 83, 1, 0, fallthrough=False)

def_op(l, "EXEC_STMT", 85, 3, 0)

def_op(l, "POP_BLOCK", 87, 0, 0)
def_op(l, "END_FINALLY", 88, 1, 0)
def_op(l, "BUILD_CLASS", 89, 3, 0)

# HAVE_ARGUMENT = 90               # Opcodes from here have an argument:

store_op(l, "STORE_NAME", 90, 1, 0, is_type="name")  # Operand is in name list
name_op(l, "DELETE_NAME", 91, 0, 0)  # ""
varargs_op(l, "UNPACK_TUPLE", 92)  # Number of tuple items
def_op(l, "UNPACK_LIST", 93)  # Number of list items
store_op(l, "STORE_ATTR", 95, 2, 0, is_type="name")  # Operand is in name list
name_op(l, "DELETE_ATTR", 96, 1, 0)  # ""
store_op(l, "STORE_GLOBAL", 97, 1, 0, is_type="name")  # ""
name_op(l, "DELETE_GLOBAL", 98, 0, 0)  # ""

const_op(l, "LOAD_CONST", 100, 0, 1)  # Operand is in const list
name_op(l, "LOAD_NAME", 101, 0, 1)  # Operand is in name list
varargs_op(l, "BUILD_TUPLE", 102, -1, 1)  # Number of tuple items
varargs_op(l, "BUILD_LIST", 103, -1, 1)  # Number of list items
varargs_op(l, "BUILD_MAP", 104, -1, 1)  # Always zero for now
name_op(l, "LOAD_ATTR", 105, 1, 1)  # Operand is in name list
compare_op(l, "COMPARE_OP", 106, 2, 1)  # Comparison operator

name_op(l, "IMPORT_NAME", 107, 2, 1)  # Operand is in name list
name_op(l, "IMPORT_FROM", 108, 0, 1)  # Operand is in name list

jrel_op(l, "JUMP_FORWARD", 110, 0, 0, fallthrough=False)  # Number of bytes to skip
github rocky / python-xdis / xdis / opcodes / opcode_2x.py View on Github external
def_op(l, "INPLACE_OR",           79,  2,  1)
def_op(l, "BREAK_LOOP",           80,  0,  0, fallthrough=False)

def_op(l, "LOAD_LOCALS",          82,  0,  1)
def_op(l, "RETURN_VALUE",         83,  1,  0, fallthrough=False)
def_op(l, "IMPORT_STAR",          84,  1,  0)
def_op(l, "EXEC_STMT",            85,  3,  0)
def_op(l, "YIELD_VALUE",          86,  1,  1)

def_op(l, "POP_BLOCK",            87,  0,  0)
def_op(l, "END_FINALLY",          88,  1,  0)
def_op(l, "BUILD_CLASS",          89,  2,  0)

HAVE_ARGUMENT = 90              # Opcodes from here have an argument:

store_op(l, "STORE_NAME",          90,  1,  0, is_type="name")  # Operand is in name list
name_op(l, "DELETE_NAME",          91,  0,  0)  # ""
varargs_op(l, "UNPACK_SEQUENCE",   92, -1,  1)  # TOS is number of tuple items
jrel_op(l, "FOR_ITER",             93,  0,  1)  # TOS is read

store_op(l, "STORE_ATTR",          95,  2,  0, is_type="name")  # Operand is in name list
name_op(l, "DELETE_ATTR",          96,  1,  0)  # ""
store_op(l, "STORE_GLOBAL",        97,  1,  0, is_type="name")  # ""
name_op(l, "DELETE_GLOBAL",        98,  0,  0)  # ""
nargs_op(l, "DUP_TOPX",            99, -1,  2)  # number of items to duplicate
const_op(l, "LOAD_CONST",         100,  0,  1)  # Operand is in const list
name_op(l, "LOAD_NAME",           101,  0,  1)  # Operand is in name list
varargs_op(l, "BUILD_TUPLE",      102, -1,  1)  # TOS is number of tuple items
varargs_op(l, "BUILD_LIST",       103, -1,  1)  # TOS is number of list items
varargs_op(l, "BUILD_MAP",        104,  0,  1)  # TOS is number of kwarg items. Always zero for now
name_op(l, "LOAD_ATTR",           105,  1,  1)  # Operand is in name list
compare_op(l, "COMPARE_OP",       106,  2,  1)  # Comparison operator