Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def_op(l, "RAISE_VARARGS", 130, -1, 0, fallthrough=False)
# Number of raise arguments (1, 2, or 3)
nargs_op(l, "CALL_FUNCTION", 131, -1, 1) # #args + (#kwargs << 8)
def_op(l, "MAKE_FUNCTION", 132, -1, 1) # Number of args with default values
varargs_op(l, "BUILD_SLICE", 133, -1, 1) # Number of items
def_op(l, "EXTENDED_ARG", 143)
EXTENDED_ARG = 143
fields2copy = """cmp_op hasjabs""".split()
update_pj2(globals(), l)
opcode_arg_fmt = {"EXTENDED_ARG": format_extended_arg}
finalize_opcodes(l)
opcode_extended_fmt = {
"CALL_FUNCTION": extended_format_CALL_FUNCTION,
"MAKE_FUNCTION": extended_format_MAKE_FUNCTION_older,
"RETURN_VALUE": extended_format_RETURN_VALUE,
}
version = 2.6
l = locals()
init_opdata(l, opcode_25, version)
# Below are opcode changes since Python 2.5
store_op(l, "STORE_MAP", 54, 3, 1)
# FIXME remove (fix uncompyle6)
update_pj2(globals(), l)
opcode_arg_fmt = {
"CALL_FUNCTION": format_CALL_FUNCTION_pos_name_encoded,
"CALL_FUNCTION_KW": format_CALL_FUNCTION_pos_name_encoded,
"CALL_FUNCTION_VAR_KW": format_CALL_FUNCTION_pos_name_encoded,
"EXTENDED_ARG": format_extended_arg,
"MAKE_FUNCTION": format_MAKE_FUNCTION_arg,
}
finalize_opcodes(l)
rm_op(l, "DELETE_DEREF", 138)
rm_op(l, "SETUP_WITH", 143)
# These are in Python 3.1 but not Python 3.2
name_op(l, "IMPORT_NAME", 108, 1, 1) # Imports TOS and TOS1; module pushed
def_op(l, "ROT_FOUR", 5, 4, 4)
def_op(l, "DUP_TOPX", 99, -1, 2) # number of items to duplicate
# This op is in 3.2 but its opcode is a 144 instead
def_op(l, "EXTENDED_ARG", 143)
update_pj3(globals(), l)
opcode_arg_fmt = {
"MAKE_FUNCTION": format_MAKE_FUNCTION_arg,
"EXTENDED_ARG": format_extended_arg,
}
finalize_opcodes(l)
update_pj2,
)
version = 2.3
python_implementation = "CPython"
l = locals()
init_opdata(l, opcode_2x, version)
update_pj2(globals(), l)
opcode_arg_fmt = {
"CALL_FUNCTION": format_CALL_FUNCTION_pos_name_encoded,
"CALL_FUNCTION_KW": format_CALL_FUNCTION_pos_name_encoded,
"CALL_FUNCTION_VAR_KW": format_CALL_FUNCTION_pos_name_encoded,
"EXTENDED_ARG": format_extended_arg,
"MAKE_FUNCTION": format_MAKE_FUNCTION_default_argc,
}
opcode_extended_fmt = {
"CALL_FUNCTION": extended_format_CALL_FUNCTION,
"RETURN_VALUE": extended_format_RETURN_VALUE,
}
finalize_opcodes(l)
)
version = 1.6
python_implementation = "CPython"
l = locals()
init_opdata(l, opcode_15, version)
# 1.6 Bytecodes not in 1.5
nargs_op(l, "CALL_FUNCTION_VAR", 140, -1, 1) # #args + (#kwargs << 8)
nargs_op(l, "CALL_FUNCTION_KW", 141, -1, 1) # #args + (#kwargs << 8)
nargs_op(l, "CALL_FUNCTION_VAR_KW", 142, -1, 1) # #args + (#kwargs << 8)
update_pj2(globals(), l)
opcode_arg_fmt = {"EXTENDED_ARG": format_extended_arg}
opcode_arg_fmt = {
"EXTENDED_ARG": format_extended_arg,
"CALL_FUNCTION": format_CALL_FUNCTION_pos_name_encoded,
"CALL_FUNCTION_KW": format_CALL_FUNCTION_pos_name_encoded,
"CALL_FUNCTION_VAR_KW": format_CALL_FUNCTION_pos_name_encoded,
"MAKE_FUNCTION": format_MAKE_FUNCTION_default_argc,
}
finalize_opcodes(l)
init_opdata,
finalize_opcodes,
format_extended_arg,
# Although these aren't used here, they are exported
update_pj2,
)
version = 1.1 # 1.2 is the same
python_implementation = "CPython"
l = locals()
init_opdata(l, opcode_13, version)
update_pj2(globals(), l)
opcode_arg_fmt = {"EXTENDED_ARG": format_extended_arg}
finalize_opcodes(l)
opcode_extended_fmt = {
"CALL_FUNCTION": extended_format_CALL_FUNCTION,
"RETURN_VALUE": extended_format_RETURN_VALUE,
}
findlinestarts = opcode_13.findlinestarts
version = 3.2
python_implementation = "CPython"
l = locals()
init_opdata(l, opcode_3x, version)
# There are no opcodes to add or change.
# If there were, they'd be listed below.
update_pj3(globals(), l)
opcode_arg_fmt = {
"MAKE_FUNCTION": format_MAKE_FUNCTION_arg,
"EXTENDED_ARG": format_extended_arg,
}
finalize_opcodes(l)
# Sometimes the function name is in the stack arg positions back.
assert len(instructions) >= 2
inst = instructions[0]
assert inst.opname in ("MAKE_FUNCTION", "MAKE_CLOSURE")
s = ""
name_inst = instructions[1]
if name_inst.opname in ("LOAD_CONST",):
s += "%s: " % name_inst.argrepr
pass
s += format_MAKE_FUNCTION_default_pos_arg(inst.arg)
return s
opcode_arg_fmt = {
"MAKE_FUNCTION": format_MAKE_FUNCTION_default_pos_arg,
"EXTENDED_ARG": format_extended_arg,
"CALL_FUNCTION": format_CALL_FUNCTION_pos_name_encoded,
}
opcode_extended_fmt = {
"CALL_FUNCTION": extended_format_CALL_FUNCTION,
"MAKE_FUNCTION": extended_format_MAKE_FUNCTION,
"RETURN_VALUE": extended_format_RETURN_VALUE,
}
#--------------------------------------------
def_op(l, 'SET_ADD', 17, 2, 0) # Calls set.add(TOS1[-i], TOS).
# Used to implement set comprehensions.
def_op(l, 'LIST_APPEND', 18, 2, 0) # Calls list.append(TOS1, TOS).
# Used to implement list comprehensions.
jrel_op(l, 'JUMP_IF_FALSE', 111, 1, 1)
jrel_op(l, 'JUMP_IF_TRUE', 112, 1, 1)
# Yes, pj2 not pj3 - Python 3.0 is more like 2.7 here with its
# JUMP_IF rather than POP_JUMP_IF.
update_pj2(globals(), l)
opcode_arg_fmt = {
'MAKE_FUNCTION': format_MAKE_FUNCTION_arg,
'EXTENDED_ARG': format_extended_arg,
}
finalize_opcodes(l)
jabs_op(l, "JUMP_IF_TRUE_OR_POP", 112) # ""
jabs_op(l, "POP_JUMP_IF_FALSE", 114, 2, 1, conditional=True) # ""
jabs_op(l, "POP_JUMP_IF_TRUE", 115, 2, 1, conditional=True) # ""
jrel_op(l, "SETUP_WITH", 143, 0, 4)
def_op(l, "EXTENDED_ARG", 145)
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.
update_pj3(globals(), l)
opcode_arg_fmt = {
"MAKE_FUNCTION": format_MAKE_FUNCTION_default_argc,
"EXTENDED_ARG": format_extended_arg,
"CALL_FUNCTION": format_CALL_FUNCTION_pos_name_encoded,
}
finalize_opcodes(l)
opcode_extended_fmt = {
"CALL_FUNCTION": extended_format_CALL_FUNCTION,
"RETURN_VALUE": extended_format_RETURN_VALUE,
"MAKE_FUNCTION": extended_format_MAKE_FUNCTION_older,
}