CLEANUP_THROW: Handles an exception raised during a throw() or close() call through the current frame. If STACK[-1] is an instance of StopIteration, pop three values from the stack and push its value member. Otherwise, re-raise STACK[-1].
RETURN_VALUE: return STACK[-1] to the caller of function
RETURN_CONST: return co_consts[consti] to the caller of function
YIELD_VALUE: yield STACK.pop() from a generator
SETUP_ANNOTATIONS: Checks whether annotations is defined in locals(), if not it is set up to an empty dict. This opcode is only emitted if a class or module body contains variable annotations statically.
POP_EXCEPT: Pops a value from the stack, which is used to restore the exception state.
RERAISE: 重新抛出异常
PUSH_EXC_INFO: 把异常信息压入栈
CHECK_EXC_MATCH: Tests whether the STACK[-2] is an exception matching STACK[-1]. Pops STACK[-1] and pushes the boolean result of the test.
CHECK_EG_MATCH: Applies split(STACK[-1]) on the exception group representing STACK[-2]
WITH_EXCEPT_START: Calls the function in position 4 on the stack with arguments (type, val, tb) representing the exception at the top of the stack. Used to implement the call context_manager.exit(*exc_info()) when an exception has occurred in a with statement
LOAD_ASSERTION_ERROR: Pushes AssertionError onto the stack
LOAD_BUILD_CLASS: Pushes builtins.build_class() onto the stack. It is later called to construct a class.
BEFORE_WITH: This opcode performs several operations before a with block starts. First, it loads exit() from the context manager and pushes it onto the stack for later use by WITH_EXCEPT_START. Then, enter() is called. Finally, the result of calling the enter() method is pushed onto the stack
MATCH_SEQUENCE: push isinstand(STACK[-1],collections.abc.Sequence) and not isinstand(STACK[-1], str/bytes/bytearray)
MATCH_KEYS: STACK[-1] is a tuple of mapping keys, and STACK[-2] is the match subject. If STACK[-2] contains all of the keys in STACK[-1], push a tuple containing the corresponding values. Otherwise, push None.
STORE_NAME(namei): name = STACK.pop() namei 是named的index
LOAD_LOCALS: Pushes a reference to the locals dictionary onto the stack
LOAD_FROM_DICT_OR_GLOBAL(i): ???
BUILD_TUPLE(count):
1 2 3 4 5 6
if count == 0: value = () else: value = tuple(STACK[-count:]) STACK = STACK[:-count] STACK.append(value)
BUILD_LIST(count): like BUILD_TUPLE but list
BUILD_SET(count): like BUILD_TUPLE but set
BUILD_MAP(count): Pushes a new dictionary object onto the stack. Pops 2 * count items so that the dictionary holds count entries: {…, STACK[-4]: STACK[-3], STACK[-2]: STACK[-1]}
BUILD_CONST_KEY_MAP(count): like BUILD_TUPLE but dict
BUILD_STRING(count): Concatenates count strings from the stack and pushes the resulting string onto the stack.
LIST_EXTEND(i):
1 2
seq = STACK.pop() list.extend(STACK[-i], seq)
SET_UPDATE(i)
1 2
seq = STACK.pop() set.update(STACK[-i], seq)
SET_UPDATE(i):
1 2
map = STACK.pop() dict.update(STACK[-i], map)
DICT_MERGE(i): Like DICT_UPDATE but raises an exception for duplicate keys.
LOAD_ATTR(namei): If the low bit of namei is not set, this replaces STACK[-1] with getattr(STACK[-1], co_names[namei>>1]).
If the low bit of namei is set, this will attempt to load a method named co_names[namei>>1] from the STACK[-1] object. STACK[-1] is popped. This bytecode distinguishes two cases: if STACK[-1] has a method with the correct name, the bytecode pushes the unbound method and STACK[-1]. STACK[-1] will be used as the first argument (self) by CALL when calling the unbound method. Otherwise, NULL and the object returned by the attribute lookup are pushed.
LOAD_SUPER_ATTR(namei): ??
COMPARE_OP(opname): Performs a Boolean operation. The operation name can be found in cmp_op[opname >> 4].
IS_OP(invert): Performs is comparison, or is not if invert is 1.
CONTAINS_OP(invert): Performs in comparison, or not in if invert is 1.