mirror of
https://github.com/python/cpython.git
synced 2024-12-18 22:34:08 +08:00
ba117ef7e9
namespace if it occurs as a free variable in a nested block. This limitation of the compiler has been lifted, and a new opcode introduced (DELETE_DEREF). This sample was valid in 2.6, but fails to compile in 3.x without this change:: >>> def f(): ... def print_error(): ... print(e) ... try: ... something ... except Exception as e: ... print_error() ... # implicit "del e" here This sample has always been invalid in Python, and now works:: >>> def outer(x): ... def inner(): ... return x ... inner() ... del x There is no need to bump the PYC magic number: the new opcode is used for code that did not compile before.
259 lines
6.2 KiB
C
259 lines
6.2 KiB
C
static void *opcode_targets[256] = {
|
|
&&_unknown_opcode,
|
|
&&TARGET_POP_TOP,
|
|
&&TARGET_ROT_TWO,
|
|
&&TARGET_ROT_THREE,
|
|
&&TARGET_DUP_TOP,
|
|
&&TARGET_DUP_TOP_TWO,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&TARGET_NOP,
|
|
&&TARGET_UNARY_POSITIVE,
|
|
&&TARGET_UNARY_NEGATIVE,
|
|
&&TARGET_UNARY_NOT,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&TARGET_UNARY_INVERT,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&TARGET_BINARY_POWER,
|
|
&&TARGET_BINARY_MULTIPLY,
|
|
&&_unknown_opcode,
|
|
&&TARGET_BINARY_MODULO,
|
|
&&TARGET_BINARY_ADD,
|
|
&&TARGET_BINARY_SUBTRACT,
|
|
&&TARGET_BINARY_SUBSCR,
|
|
&&TARGET_BINARY_FLOOR_DIVIDE,
|
|
&&TARGET_BINARY_TRUE_DIVIDE,
|
|
&&TARGET_INPLACE_FLOOR_DIVIDE,
|
|
&&TARGET_INPLACE_TRUE_DIVIDE,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&TARGET_STORE_MAP,
|
|
&&TARGET_INPLACE_ADD,
|
|
&&TARGET_INPLACE_SUBTRACT,
|
|
&&TARGET_INPLACE_MULTIPLY,
|
|
&&_unknown_opcode,
|
|
&&TARGET_INPLACE_MODULO,
|
|
&&TARGET_STORE_SUBSCR,
|
|
&&TARGET_DELETE_SUBSCR,
|
|
&&TARGET_BINARY_LSHIFT,
|
|
&&TARGET_BINARY_RSHIFT,
|
|
&&TARGET_BINARY_AND,
|
|
&&TARGET_BINARY_XOR,
|
|
&&TARGET_BINARY_OR,
|
|
&&TARGET_INPLACE_POWER,
|
|
&&TARGET_GET_ITER,
|
|
&&TARGET_STORE_LOCALS,
|
|
&&TARGET_PRINT_EXPR,
|
|
&&TARGET_LOAD_BUILD_CLASS,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&TARGET_INPLACE_LSHIFT,
|
|
&&TARGET_INPLACE_RSHIFT,
|
|
&&TARGET_INPLACE_AND,
|
|
&&TARGET_INPLACE_XOR,
|
|
&&TARGET_INPLACE_OR,
|
|
&&TARGET_BREAK_LOOP,
|
|
&&TARGET_WITH_CLEANUP,
|
|
&&_unknown_opcode,
|
|
&&TARGET_RETURN_VALUE,
|
|
&&TARGET_IMPORT_STAR,
|
|
&&_unknown_opcode,
|
|
&&TARGET_YIELD_VALUE,
|
|
&&TARGET_POP_BLOCK,
|
|
&&TARGET_END_FINALLY,
|
|
&&TARGET_POP_EXCEPT,
|
|
&&TARGET_STORE_NAME,
|
|
&&TARGET_DELETE_NAME,
|
|
&&TARGET_UNPACK_SEQUENCE,
|
|
&&TARGET_FOR_ITER,
|
|
&&TARGET_UNPACK_EX,
|
|
&&TARGET_STORE_ATTR,
|
|
&&TARGET_DELETE_ATTR,
|
|
&&TARGET_STORE_GLOBAL,
|
|
&&TARGET_DELETE_GLOBAL,
|
|
&&_unknown_opcode,
|
|
&&TARGET_LOAD_CONST,
|
|
&&TARGET_LOAD_NAME,
|
|
&&TARGET_BUILD_TUPLE,
|
|
&&TARGET_BUILD_LIST,
|
|
&&TARGET_BUILD_SET,
|
|
&&TARGET_BUILD_MAP,
|
|
&&TARGET_LOAD_ATTR,
|
|
&&TARGET_COMPARE_OP,
|
|
&&TARGET_IMPORT_NAME,
|
|
&&TARGET_IMPORT_FROM,
|
|
&&TARGET_JUMP_FORWARD,
|
|
&&TARGET_JUMP_IF_FALSE_OR_POP,
|
|
&&TARGET_JUMP_IF_TRUE_OR_POP,
|
|
&&TARGET_JUMP_ABSOLUTE,
|
|
&&TARGET_POP_JUMP_IF_FALSE,
|
|
&&TARGET_POP_JUMP_IF_TRUE,
|
|
&&TARGET_LOAD_GLOBAL,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&TARGET_CONTINUE_LOOP,
|
|
&&TARGET_SETUP_LOOP,
|
|
&&TARGET_SETUP_EXCEPT,
|
|
&&TARGET_SETUP_FINALLY,
|
|
&&_unknown_opcode,
|
|
&&TARGET_LOAD_FAST,
|
|
&&TARGET_STORE_FAST,
|
|
&&TARGET_DELETE_FAST,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&TARGET_RAISE_VARARGS,
|
|
&&TARGET_CALL_FUNCTION,
|
|
&&TARGET_MAKE_FUNCTION,
|
|
&&TARGET_BUILD_SLICE,
|
|
&&TARGET_MAKE_CLOSURE,
|
|
&&TARGET_LOAD_CLOSURE,
|
|
&&TARGET_LOAD_DEREF,
|
|
&&TARGET_STORE_DEREF,
|
|
&&TARGET_DELETE_DEREF,
|
|
&&_unknown_opcode,
|
|
&&TARGET_CALL_FUNCTION_VAR,
|
|
&&TARGET_CALL_FUNCTION_KW,
|
|
&&TARGET_CALL_FUNCTION_VAR_KW,
|
|
&&TARGET_SETUP_WITH,
|
|
&&TARGET_EXTENDED_ARG,
|
|
&&TARGET_LIST_APPEND,
|
|
&&TARGET_SET_ADD,
|
|
&&TARGET_MAP_ADD,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode,
|
|
&&_unknown_opcode
|
|
};
|