Attributes
- symbols
symbols = { Const(0) : Const('less'), Const(1) : Const('lesseq'), Const(2) : Const('equal'), Const(3) : Const('notequal'), Const(4) : Const('greater'), Const(5) : Const('greatereq'), Const(6) : Const('in'), Const(7) : Const('not in'), Const(8) : Const('is'), Const(9) : Const('is not'), Const(10) : Const('exe match'), Const(11) : Const('bad') }
Method summary
- BINARY_ADD(self, pc)
- BINARY_AND(self, pc)
- BINARY_DIVIDE(self, pc)
- BINARY_LSHIFT(self, pc)
- BINARY_MODULO(self, pc)
- BINARY_MULTIPLY(self, pc)
- BINARY_OR(self, pc)
- BINARY_POWER(self, pc)
- BINARY_RSHIFT(self, pc)
- BINARY_SUBSCR(self, pc)
- BINARY_SUBTRACT(self, pc)
- BINARY_XOR(self, pc)
- BREAK_LOOP(self, pc)
- BUILD_CLASS(self, pc)
- BUILD_LIST(self, pc, count)
- BUILD_MAP(self, pc, zero)
- BUILD_SLICE(self, pc, argc)
- BUILD_TUPLE(self, pc, count)
- CALL_FUNCTION(self, pc, argc)
- CALL_FUNCTION_KW(self, pc, argc)
- CALL_FUNCTION_VAR(self, pc, argc)
- CALL_FUNCTION_VAR_KW(self, pc, argc)
- COMPARE_OP(self, pc, opname)
- DELETE_ATTR(self, pc, namei)
- DELETE_FAST(self, pc, var_num)
- DELETE_GLOBAL(self, pc, namei)
- DELETE_NAME(self, pc, namei)
- DELETE_SLICE_0(self, pc)
- DELETE_SLICE_1(self, pc)
- DELETE_SLICE_2(self, pc)
- DELETE_SLICE_3(self, pc)
- DELETE_SUBSCR(self, pc)
- DUP_TOP(self, pc)
- DUP_TOPX(self, pc, count)
- END_FINALLY(self, pc)
- EXEC_STMT(self, pc)
- EXTENDED_ARG(self, pc, ext)
- FOR_LOOP(self, pc, delta)
- IMPORT_FROM(self, pc, namei)
- IMPORT_NAME(self, pc, namei)
- IMPORT_STAR(self, pc)
- INPLACE_ADD(self, pc)
- INPLACE_AND(self, pc)
- INPLACE_DIVIDE(self, pc)
- INPLACE_LSHIFT(self, pc)
- INPLACE_MODULO(self, pc)
- INPLACE_MULTIPLY(self, pc)
- INPLACE_OR(self, pc)
- INPLACE_POWER(self, pc)
- INPLACE_RSHIFT(self, pc)
- INPLACE_SUBTRACT(self, pc)
- INPLACE_XOR(self, pc)
- JUMP_ABSOLUTE(self, pc, target)
- JUMP_FORWARD(self, pc, delta)
- JUMP_IF_FALSE(self, pc, delta)
- JUMP_IF_TRUE(self, pc, delta)
- LOAD_ATTR(self, pc, namei)
- LOAD_CLOSURE(self, pc, i)
- LOAD_CONST(self, pc, consti)
- LOAD_DEREF(self, pc, i)
- LOAD_FAST(self, pc, var_num)
- LOAD_GLOBAL(self, pc, namei)
- LOAD_LOCALS(self, pc)
- LOAD_NAME(self, pc, namei)
- MAKE_CLOSURE(self, pc, argc)
- MAKE_FUNCTION(self, pc, argc)
- POP_BLOCK(self, pc)
- POP_TOP(self, pc)
- PRINT_EXPR(self, pc)
- PRINT_ITEM(self, pc)
- PRINT_ITEM_TO(self, pc)
- PRINT_NEWLINE(self, pc)
- PRINT_NEWLINE_TO(self, pc)
- RAISE_VARARGS(self, pc, argc)
- RETURN_VALUE(self, pc)
- ROT_FOUR(self, pc)
- ROT_THREE(self, pc)
- ROT_TWO(self, pc)
- SETUP_EXCEPT(self, pc, delta)
- SETUP_FINALLY(self, pc, delta)
- SETUP_LOOP(self, pc, delta)
- SET_LINENO(self, pc, lineno)
- SLICE_0(self, pc)
- SLICE_1(self, pc)
- SLICE_2(self, pc)
- SLICE_3(self, pc)
- STOP_CODE(self, pc)
- STORE_ATTR(self, pc, namei)
- STORE_DEREF(self, pc, i)
- STORE_FAST(self, pc, var_num)
- STORE_GLOBAL(self, pc, namei)
- STORE_NAME(self, pc, namei)
- STORE_SLICE_0(self, pc)
- STORE_SLICE_1(self, pc)
- STORE_SLICE_2(self, pc)
- STORE_SLICE_3(self, pc)
- STORE_SUBSCR(self, pc)
- UNARY_CONVERT(self, pc)
- UNARY_INVERT(self, pc)
- UNARY_NEGATIVE(self, pc)
- UNARY_NOT(self, pc)
- UNARY_POSITIVE(self, pc)
- UNPACK_SEQUENCE(self, pc, count)
- cmp_op(self, opname)
- evaluate(self, pc, code)
- execute(self, pc, opcode, argument)
- fetch(self, pc, code)
Methods
- BINARY_ADD(self, pc)
Implements TOS = TOS1 + TOS.
- BINARY_AND(self, pc)
Implements TOS = TOS1 & TOS.
- BINARY_DIVIDE(self, pc)
Implements TOS = TOS1 / TOS.
- BINARY_LSHIFT(self, pc)
Implements TOS = TOS1 << TOS.
- BINARY_MODULO(self, pc)
Implements TOS = TOS1 % TOS.
- BINARY_MULTIPLY(self, pc)
Implements TOS = TOS1 * TOS.
- BINARY_OR(self, pc)
Implements TOS = TOS1 | TOS.
- BINARY_POWER(self, pc)
Implements TOS = TOS1 ** TOS.
- BINARY_RSHIFT(self, pc)
Implements TOS = TOS1 >> TOS.
- BINARY_SUBSCR(self, pc)
Implements TOS = TOS1[TOS].
- BINARY_SUBTRACT(self, pc)
Implements TOS = TOS1 - TOS.
- BINARY_XOR(self, pc)
Implements TOS = TOS1 ^ TOS.
- BREAK_LOOP(self, pc)
Terminates a loop due to a break statement.
- BUILD_CLASS(self, pc)
Creates a new class object. TOS is the methods dictionary, TOS1 the tuple of the names of the base classes, and TOS2 the class name.
- BUILD_LIST(self, pc, count)
Works as BUILD_TUPLE, but creates a list.
- BUILD_MAP(self, pc, zero)
Pushes a new empty dictionary object onto the stack. The argument is ignored and set to zero by the compiler.
- BUILD_SLICE(self, pc, argc)
Pushes a slice object on the stack. argc must be 2 or 3. If it is 2, slice(TOS1, TOS) is pushed; if it is 3, slice(TOS2, TOS1, TOS) is pushed. See the slice() built-in function for more information.
- BUILD_TUPLE(self, pc, count)
Creates a tuple consuming count items from the stack, and pushes the resulting tuple onto the stack.
- CALL_FUNCTION(self, pc, argc)
Calls a function. The low byte of argc indicates the number of positional parameters, the high byte the number of keyword parameters. On the stack, the opcode finds the keyword parameters first. For each keyword argument, the value is on top of the key. Below the keyword parameters, the positional parameters are on the stack, with the right-most parameter on top. Below the parameters, the function object to call is on the stack.
- CALL_FUNCTION_KW(self, pc, argc)
Calls a function. argc is interpreted as in CALL_FUNCTION. The top element on the stack contains the keyword arguments dictionary, followed by explicit keyword and positional arguments.
- CALL_FUNCTION_VAR(self, pc, argc)
Calls a function. argc is interpreted as in CALL_FUNCTION. The top element on the stack contains the variable argument list, followed by keyword and positional arguments.
- CALL_FUNCTION_VAR_KW(self, pc, argc)
Calls a function. argc is interpreted as in CALL_FUNCTION. The top element on the stack contains the keyword arguments dictionary, followed by the variable-arguments tuple, followed by explicit keyword and positional arguments.
- COMPARE_OP(self, pc, opname)
Performs a Boolean operation. The operation name can be found in cmp_op[opname].
- DELETE_ATTR(self, pc, namei)
Implements del TOS.name, using namei as index into co_names.
- DELETE_FAST(self, pc, var_num)
Deletes local co_varnames[var_num].
- DELETE_GLOBAL(self, pc, namei)
Works as DELETE_NAME, but deletes a global name.
- DELETE_NAME(self, pc, namei)
Implements del name, where namei is the index into co_names attribute of the code object.
- DELETE_SLICE_0(self, pc)
Implements del TOS[:].
- DELETE_SLICE_1(self, pc)
Implements del TOS1[TOS:].
- DELETE_SLICE_2(self, pc)
Implements del TOS1[:TOS].
- DELETE_SLICE_3(self, pc)
Implements del TOS2[TOS1:TOS].
- DELETE_SUBSCR(self, pc)
Implements del TOS1[TOS].
- DUP_TOP(self, pc)
Duplicates the reference on top of the stack.
- DUP_TOPX(self, pc, count)
Duplicate count items, keeping them in the same order. Due to implementation limits, count should be between 1 and 5 inclusive.
- END_FINALLY(self, pc)
Terminates a finally clause. The interpreter recalls whether the exception has to be re-raised, or whether the function returns, and continues with the outer-next block.
- EXEC_STMT(self, pc)
Implements exec TOS2,TOS1,TOS. The compiler fills missing optional parameters with None.
- EXTENDED_ARG(self, pc, ext)
Prefixes any opcode which has an argument too big to fit into the default two bytes. ext holds two additional bytes which, taken together with the subsequent opcode's argument, comprise a four-byte argument, ext being the two most-significant bytes.
- FOR_LOOP(self, pc, delta)
Iterate over a sequence. TOS is the current index, TOS1 the sequence. First, the next element is computed. If the sequence is exhausted, increment byte code counter by delta. Otherwise, push the sequence, the incremented counter, and the current item onto the stack.
- IMPORT_FROM(self, pc, namei)
Loads the attribute co_names[namei] from the module found in TOS. The resulting object is pushed onto the stack, to be subsequently stored by a STORE_FAST instruction.
- IMPORT_NAME(self, pc, namei)
Imports the module co_names[namei]. The module object is pushed onto the stack. The current namespace is not affected: for a proper import statement, a subsequent STORE_FAST instruction modifies the namespace.
- IMPORT_STAR(self, pc)
Loads all symbols not starting with _ directly from the module TOS to the local namespace. The module is popped after loading all names. This opcode implements from module import *.
- INPLACE_ADD(self, pc)
Implements in-place TOS = TOS1 + TOS.
- INPLACE_AND(self, pc)
Implements in-place TOS = TOS1 & TOS.
- INPLACE_DIVIDE(self, pc)
Implements in-place TOS = TOS1 / TOS.
- INPLACE_LSHIFT(self, pc)
Implements in-place TOS = TOS1 << TOS.
- INPLACE_MODULO(self, pc)
Implements in-place TOS = TOS1 % TOS.
- INPLACE_MULTIPLY(self, pc)
Implements in-place TOS = TOS1 * TOS.
- INPLACE_OR(self, pc)
Implements in-place TOS = TOS1 | TOS.
- INPLACE_POWER(self, pc)
Implements in-place TOS = TOS1 ** TOS.
- INPLACE_RSHIFT(self, pc)
Implements in-place TOS = TOS1 >> TOS.
- INPLACE_SUBTRACT(self, pc)
Implements in-place TOS = TOS1 - TOS.
- INPLACE_XOR(self, pc)
Implements in-place TOS = TOS1 ^ TOS.
- JUMP_ABSOLUTE(self, pc, target)
Set byte code counter to target.
- JUMP_FORWARD(self, pc, delta)
Increments byte code counter by delta.
- JUMP_IF_FALSE(self, pc, delta)
If TOS is false, increment the byte code counter by delta. TOS is not changed.
- JUMP_IF_TRUE(self, pc, delta)
If TOS is true, increment the byte code counter by delta. TOS is left on the stack.
- LOAD_ATTR(self, pc, namei)
Replaces TOS with getattr(TOS, co_names[namei].
- LOAD_CLOSURE(self, pc, i)
Pushes a reference to the cell contained in slot i of the cell and free variable storage. The name of the variable is co_cellvars[i] if i is less than the length of co_cellvars. Otherwise it is co_freevars[i - len(co_cellvars)].
- LOAD_CONST(self, pc, consti)
Pushes co_consts[consti] onto the stack.
- LOAD_DEREF(self, pc, i)
Loads the cell contained in slot i of the cell and free variable storage. Pushes a reference to the object the cell contains on the stack.
- LOAD_FAST(self, pc, var_num)
Pushes a reference to the local co_varnames[var_num] onto the stack.
- LOAD_GLOBAL(self, pc, namei)
Loads the global named co_names[namei] onto the stack.
- LOAD_LOCALS(self, pc)
Pushes a reference to the locals of the current scope on the stack. This is used in the code for a class definition: After the class body is evaluated, the locals are passed to the class definition.
- LOAD_NAME(self, pc, namei)
Pushes the value associated with co_names[namei] onto the stack.
- MAKE_CLOSURE(self, pc, argc)
Creates a new function object, sets its func_closure slot, and pushes it on the stack. TOS is the code associated with the function. If the code object has N free variables, the next N items on the stack are the cells for these variables. The function also has argc default parameters, where are found before the cells.
- MAKE_FUNCTION(self, pc, argc)
Pushes a new function object on the stack. TOS is the code associated with the function. The function object is defined to have argc default parameters, which are found below TOS.
- POP_BLOCK(self, pc)
Removes one block from the block stack. Per frame, there is a stack of blocks, denoting nested loops, try statements, and such.
- POP_TOP(self, pc)
Removes the top-of-stack (TOS) item.
- PRINT_EXPR(self, pc)
Implements the expression statement for the interactive mode. TOS is removed from the stack and printed. In non-interactive mode, an expression statement is terminated with POP_STACK.
- PRINT_ITEM(self, pc)
Prints TOS to the file-like object bound to sys.stdout. There is one such instruction for each item in the print statement.
- PRINT_ITEM_TO(self, pc)
Like PRINT_ITEM, but prints the item second from TOS to the file-like object at TOS. This is used by the extended print statement.
- PRINT_NEWLINE(self, pc)
Prints a new line on sys.stdout. This is generated as the last operation of a print statement, unless the statement ends with a comma.
- PRINT_NEWLINE_TO(self, pc)
Like PRINT_NEWLINE, but prints the new line on the file-like object on the TOS. This is used by the extended print statement.
- RAISE_VARARGS(self, pc, argc)
Raises an exception. argc indicates the number of parameters to the raise statement, ranging from 0 to 3. The handler will find the traceback as TOS2, the parameter as TOS1, and the exception as TOS.
- RETURN_VALUE(self, pc)
Returns with TOS to the caller of the function.
- ROT_FOUR(self, pc)
Lifts second, third and forth stack item one position up, moves top down to position four.
- ROT_THREE(self, pc)
Lifts second and third stack item one position up, moves top down to position three.
- ROT_TWO(self, pc)
Swaps the two top-most stack items.
- SETUP_EXCEPT(self, pc, delta)
Pushes a try block from a try-except clause onto the block stack. delta points to the first except block.
- SETUP_FINALLY(self, pc, delta)
Pushes a try block from a try-except clause onto the block stack. delta points to the finally block.
- SETUP_LOOP(self, pc, delta)
Pushes a block for a loop onto the block stack. The block spans from the current instruction with a size of delta bytes.
- SET_LINENO(self, pc, lineno)
Sets the current line number to lineno.
- SLICE_0(self, pc)
Implements TOS = TOS[:].
- SLICE_1(self, pc)
Implements TOS = TOS1[TOS:].
- SLICE_2(self, pc)
Implements TOS = TOS1[:TOS1].
- SLICE_3(self, pc)
Implements TOS = TOS2[TOS1:TOS].
- STOP_CODE(self, pc)
Indicates end-of-code to the compiler, not used by the interpreter.
- STORE_ATTR(self, pc, namei)
Implements TOS.name = TOS1, where namei is the index of name in co_names.
- STORE_DEREF(self, pc, i)
Stores TOS into the cell contained in slot i of the cell and free variable storage.
- STORE_FAST(self, pc, var_num)
Stores TOS into the local co_varnames[var_num].
- STORE_GLOBAL(self, pc, namei)
Works as STORE_NAME, but stores the name as a global.
- STORE_NAME(self, pc, namei)
Implements name = TOS. namei is the index of name in the attribute co_names of the code object. The compiler tries to use STORE_LOCAL or STORE_GLOBAL if possible.
- STORE_SLICE_0(self, pc)
Implements TOS[:] = TOS1.
- STORE_SLICE_1(self, pc)
Implements TOS1[TOS:] = TOS2.
- STORE_SLICE_2(self, pc)
Implements TOS1[:TOS] = TOS2.
- STORE_SLICE_3(self, pc)
Implements TOS2[TOS1:TOS] = TOS3.
- STORE_SUBSCR(self, pc)
Implements TOS1[TOS] = TOS2.
- UNARY_CONVERT(self, pc)
Implements TOS = TOS.
- UNARY_INVERT(self, pc)
Implements TOS = ~TOS.
- UNARY_NEGATIVE(self, pc)
Implements TOS = -TOS.
- UNARY_NOT(self, pc)
Implements TOS = not TOS.
- UNARY_POSITIVE(self, pc)
Implements TOS = +TOS.
- UNPACK_SEQUENCE(self, pc, count)
Unpacks TOS into count individual values, which are put onto the stack right-to-left.
- cmp_op(self, opname)
- evaluate(self, pc, code)
- execute(self, pc, opcode, argument)
- fetch(self, pc, code)
