Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
format_CALL_FUNCTION_pos_name_encoded,
format_extended_arg,
free_op,
init_opdata,
rm_op,
update_pj3,
)
import xdis.opcodes.opcode_33 as opcode_33
version = 3.4
python_implementation = "CPython"
l = locals()
init_opdata(l, opcode_33, version)
# These are removed since Python 3.3
rm_op(l, "STORE_LOCALS", 69)
# These are new since Python 3.3
free_op(l, "LOAD_CLASSDEREF", 148)
update_pj3(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,
"MAKE_FUNCTION": opcode_33.format_MAKE_FUNCTION_default_pos_arg,
"EXTENDED_ARG": format_extended_arg,
}
from xdis.opcodes.base import (
extended_format_CALL_FUNCTION,
extended_format_RETURN_VALUE,
init_opdata,
rm_op,
finalize_opcodes,
format_extended_arg,
# Although these aren't used here, they are exported
update_pj2,
)
version = 1.0
python_implementation = "CPython"
l = locals()
init_opdata(l, opcode_11, version)
# 1.0 - 1.1 bytecodes differences
rm_op(l, "LOAD_GLOBALS", 84)
rm_op(l, "EXEC_STMT", 85)
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,
}
format_MAKE_FUNCTION_arg,
format_extended_arg,
init_opdata,
name_op,
rm_op,
update_pj3,
)
import xdis.opcodes.opcode_32 as opcode_32
l = locals()
version = 3.1
python_implementation = "CPython"
init_opdata(l, opcode_32, version)
# These are in Python 3.2 but not in Python 3.1
rm_op(l, "DUP_TOP_TWO", 5)
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)
init_opdata,
def_op,
extended_format_RETURN_VALUE,
name_op,
varargs_op,
finalize_opcodes,
format_extended_arg,
# Although these aren't used here, they are exported
update_pj2,
)
version = 1.4
python_implementation = "CPython"
l = locals()
init_opdata(l, opcode_15, version)
# 1.4 Bytecodes not in 1.5
def_op(l, "UNARY_CALL", 14)
def_op(l, "BINARY_CALL", 26)
def_op(l, "RAISE_EXCEPTION", 81)
def_op(l, "BUILD_FUNCTION", 86)
varargs_op(l, "UNPACK_ARG", 94) # Number of arguments expected
varargs_op(l, "UNPACK_VARARG", 99) # Minimal number of arguments
name_op(l, "LOAD_LOCAL", 115)
varargs_op(l, "SET_FUNC_ARGS", 117) # Argcount
varargs_op(l, "RESERVE_FAST", 123) # Number of local variables
update_pj2(globals(), l)
opcode_arg_fmt = {"EXTENDED_ARG": format_extended_arg}
import xdis.opcodes.opcode_15 as opcode_15
from xdis.opcodes.base import (
init_opdata,
nargs_op,
finalize_opcodes,
format_CALL_FUNCTION_pos_name_encoded,
format_MAKE_FUNCTION_default_argc,
format_extended_arg,
update_pj2,
)
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,
update_pj3,
varargs_op,
)
import xdis.opcodes.opcode_34 as opcode_34
from xdis.opcodes.opcode_33 import (
extended_format_MAKE_FUNCTION,
format_MAKE_FUNCTION_default_pos_arg,
)
version = 3.5
python_implementation = "CPython"
l = locals()
init_opdata(l, opcode_34, version)
# These are removed since Python 3.5.
# Removals happen before adds since
# some opcodes are reused
rm_op(l, "STORE_MAP", 54)
rm_op(l, "WITH_CLEANUP", 81)
# Stack effects are change from 3.4
varargs_op(l, "BUILD_MAP", 105, -1, -1) # arg is count of kwarg items
# These are new since Python 3.5
# OP NAME OPCODE POP PUSH
#---------------------------------------------------
def_op(l, "BINARY_MATRIX_MULTIPLY", 16, 2, 1)
def_op(l, "INPLACE_MATRIX_MULTIPLY", 17, 2, 1)
def_op(l, "GET_AITER", 50, 1, 1)
from xdis.opcodes.base import (
finalize_opcodes,
format_MAKE_FUNCTION_arg,
format_extended_arg,
init_opdata,
update_pj3,
)
# FIXME: can we DRY this even more?
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)
from xdis.opcodes.base import (
store_op,
finalize_opcodes,
format_CALL_FUNCTION_pos_name_encoded,
format_MAKE_FUNCTION_arg,
format_extended_arg,
init_opdata,
update_pj2,
)
import xdis.opcodes.opcode_25 as opcode_25
python_implementation = "CPython"
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)
finalize_opcodes,
init_opdata,
jrel_op,
name_op,
nargs_op,
varargs_op,
update_pj3,
)
version = 3.2
python_implementation = "PyPy"
import xdis.opcodes.opcode_32 as opcode_32
l = locals()
init_opdata(l, opcode_32, version, is_pypy=True)
## FIXME: DRY common PYPY opcode additions
# PyPy only
# ----------
name_op(l, "LOOKUP_METHOD", 201, 1, 2)
nargs_op(l, "CALL_METHOD", 202, -1, 1)
l["hasvargs"].append(202)
# Used only in single-mode compilation list-comprehension generators
varargs_op(l, "BUILD_LIST_FROM_ARG", 203)
# Used only in assert statements
jrel_op(l, "JUMP_IF_NOT_DEBUG", 204, conditional=True)
# There are no opcodes to remove or change.
import xdis.opcodes.opcode_13 as opcode_13
from xdis.opcodes.base import (
extended_format_CALL_FUNCTION,
extended_format_RETURN_VALUE,
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