1# (C) Copyright 2017, 2019 by Rocky Bernstein 2""" 3CPython 2.2 bytecode opcodes 4 5This is similar to the opcode portion in Python 2.2's dis.py library. 6""" 7 8import xdis.opcodes.opcode_2x as opcode_2x 9from xdis.opcodes.base import ( 10 def_op, 11 extended_format_ATTR, 12 extended_format_MAKE_FUNCTION_older, 13 extended_format_RETURN_VALUE, 14 init_opdata, 15 finalize_opcodes, 16 format_extended_arg, 17 update_pj2, 18) 19 20version = 2.2 21python_implementation = "CPython" 22 23l = locals() 24init_opdata(l, opcode_2x, version) 25 26# 2.2 Bytecodes not in 2.3 27def_op(l, "FOR_LOOP", 114) 28def_op(l, "SET_LINENO", 127, 0, 0) 29 30update_pj2(globals(), l) 31 32 33finalize_opcodes(l) 34 35opcode_arg_fmt = { 36 "EXTENDED_ARG": format_extended_arg 37} 38 39opcode_extended_fmt = { 40 "LOAD_ATTR": extended_format_ATTR, 41 "MAKE_FUNCTION": extended_format_MAKE_FUNCTION_older, 42 "RETURN_VALUE": extended_format_RETURN_VALUE, 43 "STORE_ATTR": extended_format_ATTR, 44} 45