From 3af4084473987db662420ec46622f983188a1d79 Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Mon, 5 Jun 2023 09:03:55 +0100 Subject: [PATCH 1/3] Avoid conditional stack effects when compiling f-strings. --- Include/internal/pycore_opcode.h | 52 +- Include/opcode.h | 88 +-- Lib/dis.py | 19 +- Lib/importlib/_bootstrap_external.py | 3 +- Lib/opcode.py | 5 +- Lib/test/test_dis.py | 10 +- ...3-06-05-08-30-49.gh-issue-33092.hZ0xSI.rst | 3 + Programs/test_frozenmain.h | 4 +- Python/bytecodes.c | 54 +- Python/ceval.c | 8 + Python/compile.c | 28 +- Python/generated_cases.c.h | 616 +++++++++--------- Python/opcode_metadata.h | 18 +- Python/opcode_targets.h | 46 +- 14 files changed, 486 insertions(+), 468 deletions(-) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2023-06-05-08-30-49.gh-issue-33092.hZ0xSI.rst diff --git a/Include/internal/pycore_opcode.h b/Include/internal/pycore_opcode.h index 784b86ed49bde7..fcb10fda4a1514 100644 --- a/Include/internal/pycore_opcode.h +++ b/Include/internal/pycore_opcode.h @@ -102,6 +102,7 @@ const uint8_t _PyOpcode_Deopt[256] = { [COMPARE_OP_INT] = COMPARE_OP, [COMPARE_OP_STR] = COMPARE_OP, [CONTAINS_OP] = CONTAINS_OP, + [CONVERT_VALUE] = CONVERT_VALUE, [COPY] = COPY, [COPY_FREE_VARS] = COPY_FREE_VARS, [DELETE_ATTR] = DELETE_ATTR, @@ -117,7 +118,8 @@ const uint8_t _PyOpcode_Deopt[256] = { [END_SEND] = END_SEND, [ENTER_EXECUTOR] = ENTER_EXECUTOR, [EXTENDED_ARG] = EXTENDED_ARG, - [FORMAT_VALUE] = FORMAT_VALUE, + [FORMAT_SIMPLE] = FORMAT_SIMPLE, + [FORMAT_WITH_SPEC] = FORMAT_WITH_SPEC, [FOR_ITER] = FOR_ITER, [FOR_ITER_GEN] = FOR_ITER, [FOR_ITER_LIST] = FOR_ITER, @@ -287,6 +289,8 @@ static const char *const _PyOpcode_OpName[267] = { [CHECK_EG_MATCH] = "CHECK_EG_MATCH", [CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS] = "CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS", [CALL_NO_KW_BUILTIN_FAST] = "CALL_NO_KW_BUILTIN_FAST", + [FORMAT_SIMPLE] = "FORMAT_SIMPLE", + [FORMAT_WITH_SPEC] = "FORMAT_WITH_SPEC", [CALL_NO_KW_BUILTIN_O] = "CALL_NO_KW_BUILTIN_O", [CALL_NO_KW_ISINSTANCE] = "CALL_NO_KW_ISINSTANCE", [CALL_NO_KW_LEN] = "CALL_NO_KW_LEN", @@ -294,8 +298,6 @@ static const char *const _PyOpcode_OpName[267] = { [CALL_NO_KW_METHOD_DESCRIPTOR_FAST] = "CALL_NO_KW_METHOD_DESCRIPTOR_FAST", [CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS] = "CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS", [CALL_NO_KW_METHOD_DESCRIPTOR_O] = "CALL_NO_KW_METHOD_DESCRIPTOR_O", - [CALL_NO_KW_STR_1] = "CALL_NO_KW_STR_1", - [CALL_NO_KW_TUPLE_1] = "CALL_NO_KW_TUPLE_1", [WITH_EXCEPT_START] = "WITH_EXCEPT_START", [GET_AITER] = "GET_AITER", [GET_ANEXT] = "GET_ANEXT", @@ -303,39 +305,39 @@ static const char *const _PyOpcode_OpName[267] = { [BEFORE_WITH] = "BEFORE_WITH", [END_ASYNC_FOR] = "END_ASYNC_FOR", [CLEANUP_THROW] = "CLEANUP_THROW", + [CALL_NO_KW_STR_1] = "CALL_NO_KW_STR_1", + [CALL_NO_KW_TUPLE_1] = "CALL_NO_KW_TUPLE_1", [CALL_NO_KW_TYPE_1] = "CALL_NO_KW_TYPE_1", [COMPARE_OP_FLOAT] = "COMPARE_OP_FLOAT", - [COMPARE_OP_INT] = "COMPARE_OP_INT", - [COMPARE_OP_STR] = "COMPARE_OP_STR", [STORE_SUBSCR] = "STORE_SUBSCR", [DELETE_SUBSCR] = "DELETE_SUBSCR", + [COMPARE_OP_INT] = "COMPARE_OP_INT", + [COMPARE_OP_STR] = "COMPARE_OP_STR", [FOR_ITER_LIST] = "FOR_ITER_LIST", [FOR_ITER_TUPLE] = "FOR_ITER_TUPLE", [FOR_ITER_RANGE] = "FOR_ITER_RANGE", [FOR_ITER_GEN] = "FOR_ITER_GEN", - [LOAD_SUPER_ATTR_ATTR] = "LOAD_SUPER_ATTR_ATTR", - [LOAD_SUPER_ATTR_METHOD] = "LOAD_SUPER_ATTR_METHOD", [GET_ITER] = "GET_ITER", [GET_YIELD_FROM_ITER] = "GET_YIELD_FROM_ITER", - [LOAD_ATTR_CLASS] = "LOAD_ATTR_CLASS", + [LOAD_SUPER_ATTR_ATTR] = "LOAD_SUPER_ATTR_ATTR", [LOAD_BUILD_CLASS] = "LOAD_BUILD_CLASS", - [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = "LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN", - [LOAD_ATTR_INSTANCE_VALUE] = "LOAD_ATTR_INSTANCE_VALUE", + [LOAD_SUPER_ATTR_METHOD] = "LOAD_SUPER_ATTR_METHOD", + [LOAD_ATTR_CLASS] = "LOAD_ATTR_CLASS", [LOAD_ASSERTION_ERROR] = "LOAD_ASSERTION_ERROR", [RETURN_GENERATOR] = "RETURN_GENERATOR", + [LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN] = "LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN", + [LOAD_ATTR_INSTANCE_VALUE] = "LOAD_ATTR_INSTANCE_VALUE", [LOAD_ATTR_MODULE] = "LOAD_ATTR_MODULE", [LOAD_ATTR_PROPERTY] = "LOAD_ATTR_PROPERTY", [LOAD_ATTR_SLOT] = "LOAD_ATTR_SLOT", [LOAD_ATTR_WITH_HINT] = "LOAD_ATTR_WITH_HINT", [LOAD_ATTR_METHOD_LAZY_DICT] = "LOAD_ATTR_METHOD_LAZY_DICT", - [LOAD_ATTR_METHOD_NO_DICT] = "LOAD_ATTR_METHOD_NO_DICT", - [LOAD_ATTR_METHOD_WITH_VALUES] = "LOAD_ATTR_METHOD_WITH_VALUES", [RETURN_VALUE] = "RETURN_VALUE", - [LOAD_CONST__LOAD_FAST] = "LOAD_CONST__LOAD_FAST", + [LOAD_ATTR_METHOD_NO_DICT] = "LOAD_ATTR_METHOD_NO_DICT", [SETUP_ANNOTATIONS] = "SETUP_ANNOTATIONS", - [LOAD_FAST__LOAD_CONST] = "LOAD_FAST__LOAD_CONST", + [LOAD_ATTR_METHOD_WITH_VALUES] = "LOAD_ATTR_METHOD_WITH_VALUES", [LOAD_LOCALS] = "LOAD_LOCALS", - [LOAD_GLOBAL_BUILTIN] = "LOAD_GLOBAL_BUILTIN", + [LOAD_CONST__LOAD_FAST] = "LOAD_CONST__LOAD_FAST", [POP_EXCEPT] = "POP_EXCEPT", [STORE_NAME] = "STORE_NAME", [DELETE_NAME] = "DELETE_NAME", @@ -358,9 +360,9 @@ static const char *const _PyOpcode_OpName[267] = { [IMPORT_NAME] = "IMPORT_NAME", [IMPORT_FROM] = "IMPORT_FROM", [JUMP_FORWARD] = "JUMP_FORWARD", + [LOAD_FAST__LOAD_CONST] = "LOAD_FAST__LOAD_CONST", + [LOAD_GLOBAL_BUILTIN] = "LOAD_GLOBAL_BUILTIN", [LOAD_GLOBAL_MODULE] = "LOAD_GLOBAL_MODULE", - [STORE_ATTR_INSTANCE_VALUE] = "STORE_ATTR_INSTANCE_VALUE", - [STORE_ATTR_SLOT] = "STORE_ATTR_SLOT", [POP_JUMP_IF_FALSE] = "POP_JUMP_IF_FALSE", [POP_JUMP_IF_TRUE] = "POP_JUMP_IF_TRUE", [LOAD_GLOBAL] = "LOAD_GLOBAL", @@ -395,26 +397,26 @@ static const char *const _PyOpcode_OpName[267] = { [LIST_APPEND] = "LIST_APPEND", [SET_ADD] = "SET_ADD", [MAP_ADD] = "MAP_ADD", - [STORE_ATTR_WITH_HINT] = "STORE_ATTR_WITH_HINT", + [STORE_ATTR_INSTANCE_VALUE] = "STORE_ATTR_INSTANCE_VALUE", [COPY_FREE_VARS] = "COPY_FREE_VARS", [YIELD_VALUE] = "YIELD_VALUE", [RESUME] = "RESUME", [MATCH_CLASS] = "MATCH_CLASS", + [STORE_ATTR_SLOT] = "STORE_ATTR_SLOT", + [STORE_ATTR_WITH_HINT] = "STORE_ATTR_WITH_HINT", [STORE_SUBSCR_DICT] = "STORE_SUBSCR_DICT", - [STORE_SUBSCR_LIST_INT] = "STORE_SUBSCR_LIST_INT", - [FORMAT_VALUE] = "FORMAT_VALUE", [BUILD_CONST_KEY_MAP] = "BUILD_CONST_KEY_MAP", [BUILD_STRING] = "BUILD_STRING", + [CONVERT_VALUE] = "CONVERT_VALUE", + [STORE_SUBSCR_LIST_INT] = "STORE_SUBSCR_LIST_INT", [UNPACK_SEQUENCE_LIST] = "UNPACK_SEQUENCE_LIST", [UNPACK_SEQUENCE_TUPLE] = "UNPACK_SEQUENCE_TUPLE", - [UNPACK_SEQUENCE_TWO_TUPLE] = "UNPACK_SEQUENCE_TWO_TUPLE", - [SEND_GEN] = "SEND_GEN", [LIST_EXTEND] = "LIST_EXTEND", [SET_UPDATE] = "SET_UPDATE", [DICT_MERGE] = "DICT_MERGE", [DICT_UPDATE] = "DICT_UPDATE", - [166] = "<166>", - [167] = "<167>", + [UNPACK_SEQUENCE_TWO_TUPLE] = "UNPACK_SEQUENCE_TWO_TUPLE", + [SEND_GEN] = "SEND_GEN", [LOAD_FAST_LOAD_FAST] = "LOAD_FAST_LOAD_FAST", [STORE_FAST_LOAD_FAST] = "STORE_FAST_LOAD_FAST", [STORE_FAST_STORE_FAST] = "STORE_FAST_STORE_FAST", @@ -518,8 +520,6 @@ static const char *const _PyOpcode_OpName[267] = { #endif #define EXTRA_CASES \ - case 166: \ - case 167: \ case 177: \ case 178: \ case 179: \ diff --git a/Include/opcode.h b/Include/opcode.h index 7aa6f84199332b..9888b32a225536 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -29,6 +29,8 @@ extern "C" { #define PUSH_EXC_INFO 35 #define CHECK_EXC_MATCH 36 #define CHECK_EG_MATCH 37 +#define FORMAT_SIMPLE 40 +#define FORMAT_WITH_SPEC 41 #define WITH_EXCEPT_START 49 #define GET_AITER 50 #define GET_ANEXT 51 @@ -107,9 +109,9 @@ extern "C" { #define YIELD_VALUE 150 #define RESUME 151 #define MATCH_CLASS 152 -#define FORMAT_VALUE 155 #define BUILD_CONST_KEY_MAP 156 #define BUILD_STRING 157 +#define CONVERT_VALUE 158 #define LIST_EXTEND 162 #define SET_UPDATE 163 #define DICT_MERGE 164 @@ -175,48 +177,48 @@ extern "C" { #define CALL_BUILTIN_FAST_WITH_KEYWORDS 34 #define CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS 38 #define CALL_NO_KW_BUILTIN_FAST 39 -#define CALL_NO_KW_BUILTIN_O 40 -#define CALL_NO_KW_ISINSTANCE 41 -#define CALL_NO_KW_LEN 42 -#define CALL_NO_KW_LIST_APPEND 43 -#define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 44 -#define CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS 45 -#define CALL_NO_KW_METHOD_DESCRIPTOR_O 46 -#define CALL_NO_KW_STR_1 47 -#define CALL_NO_KW_TUPLE_1 48 -#define CALL_NO_KW_TYPE_1 56 -#define COMPARE_OP_FLOAT 57 -#define COMPARE_OP_INT 58 -#define COMPARE_OP_STR 59 -#define FOR_ITER_LIST 62 -#define FOR_ITER_TUPLE 63 -#define FOR_ITER_RANGE 64 -#define FOR_ITER_GEN 65 -#define LOAD_SUPER_ATTR_ATTR 66 -#define LOAD_SUPER_ATTR_METHOD 67 -#define LOAD_ATTR_CLASS 70 -#define LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN 72 -#define LOAD_ATTR_INSTANCE_VALUE 73 -#define LOAD_ATTR_MODULE 76 -#define LOAD_ATTR_PROPERTY 77 -#define LOAD_ATTR_SLOT 78 -#define LOAD_ATTR_WITH_HINT 79 -#define LOAD_ATTR_METHOD_LAZY_DICT 80 -#define LOAD_ATTR_METHOD_NO_DICT 81 -#define LOAD_ATTR_METHOD_WITH_VALUES 82 -#define LOAD_CONST__LOAD_FAST 84 -#define LOAD_FAST__LOAD_CONST 86 -#define LOAD_GLOBAL_BUILTIN 88 -#define LOAD_GLOBAL_MODULE 111 -#define STORE_ATTR_INSTANCE_VALUE 112 -#define STORE_ATTR_SLOT 113 -#define STORE_ATTR_WITH_HINT 148 -#define STORE_SUBSCR_DICT 153 -#define STORE_SUBSCR_LIST_INT 154 -#define UNPACK_SEQUENCE_LIST 158 -#define UNPACK_SEQUENCE_TUPLE 159 -#define UNPACK_SEQUENCE_TWO_TUPLE 160 -#define SEND_GEN 161 +#define CALL_NO_KW_BUILTIN_O 42 +#define CALL_NO_KW_ISINSTANCE 43 +#define CALL_NO_KW_LEN 44 +#define CALL_NO_KW_LIST_APPEND 45 +#define CALL_NO_KW_METHOD_DESCRIPTOR_FAST 46 +#define CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS 47 +#define CALL_NO_KW_METHOD_DESCRIPTOR_O 48 +#define CALL_NO_KW_STR_1 56 +#define CALL_NO_KW_TUPLE_1 57 +#define CALL_NO_KW_TYPE_1 58 +#define COMPARE_OP_FLOAT 59 +#define COMPARE_OP_INT 62 +#define COMPARE_OP_STR 63 +#define FOR_ITER_LIST 64 +#define FOR_ITER_TUPLE 65 +#define FOR_ITER_RANGE 66 +#define FOR_ITER_GEN 67 +#define LOAD_SUPER_ATTR_ATTR 70 +#define LOAD_SUPER_ATTR_METHOD 72 +#define LOAD_ATTR_CLASS 73 +#define LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN 76 +#define LOAD_ATTR_INSTANCE_VALUE 77 +#define LOAD_ATTR_MODULE 78 +#define LOAD_ATTR_PROPERTY 79 +#define LOAD_ATTR_SLOT 80 +#define LOAD_ATTR_WITH_HINT 81 +#define LOAD_ATTR_METHOD_LAZY_DICT 82 +#define LOAD_ATTR_METHOD_NO_DICT 84 +#define LOAD_ATTR_METHOD_WITH_VALUES 86 +#define LOAD_CONST__LOAD_FAST 88 +#define LOAD_FAST__LOAD_CONST 111 +#define LOAD_GLOBAL_BUILTIN 112 +#define LOAD_GLOBAL_MODULE 113 +#define STORE_ATTR_INSTANCE_VALUE 148 +#define STORE_ATTR_SLOT 153 +#define STORE_ATTR_WITH_HINT 154 +#define STORE_SUBSCR_DICT 155 +#define STORE_SUBSCR_LIST_INT 159 +#define UNPACK_SEQUENCE_LIST 160 +#define UNPACK_SEQUENCE_TUPLE 161 +#define UNPACK_SEQUENCE_TWO_TUPLE 166 +#define SEND_GEN 167 #define HAS_ARG(op) ((((op) >= HAVE_ARGUMENT) && (!IS_PSEUDO_OPCODE(op)))\ || ((op) == JUMP) \ diff --git a/Lib/dis.py b/Lib/dis.py index 043f5e67070494..df6b7e75131266 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -25,13 +25,8 @@ _have_code = (types.MethodType, types.FunctionType, types.CodeType, classmethod, staticmethod, type) -FORMAT_VALUE = opmap['FORMAT_VALUE'] -FORMAT_VALUE_CONVERTERS = ( - (None, ''), - (str, 'str'), - (repr, 'repr'), - (ascii, 'ascii'), -) +CONVERT_VALUE = opmap['CONVERT_VALUE'] + MAKE_FUNCTION = opmap['MAKE_FUNCTION'] MAKE_FUNCTION_FLAGS = ('defaults', 'kwdefaults', 'annotations', 'closure') @@ -508,13 +503,9 @@ def _get_instructions_bytes(code, varname_from_oparg=None, elif deop in hascompare: argval = cmp_op[arg>>4] argrepr = argval - elif deop == FORMAT_VALUE: - argval, argrepr = FORMAT_VALUE_CONVERTERS[arg & 0x3] - argval = (argval, bool(arg & 0x4)) - if argval[1]: - if argrepr: - argrepr += ', ' - argrepr += 'with format' + elif deop == CONVERT_VALUE: + argval = (None, str, repr, ascii)[arg] + argrepr = ('', 'str', 'repr', 'ascii')[arg] elif deop == MAKE_FUNCTION: argrepr = ', '.join(s for i, s in enumerate(MAKE_FUNCTION_FLAGS) if arg & (1<= FVC_STR && oparg <= FVC_ASCII); + conv_fn = CONVERSION_FUNCTIONS[oparg]; + result = conv_fn(value); + Py_DECREF(value); + ERROR_IF(result == NULL, error); + } - /* If there's a conversion function, call it and replace - value with that result. Otherwise, just use value, - without conversion. */ - if (conv_fn != NULL) { - result = conv_fn(value); + inst(FORMAT_SIMPLE, (value -- res)) { + /* If value is a unicode object, then we know the result + * of format(value) is value itself. */ + if (!PyUnicode_CheckExact(value)) { + res = PyObject_Format(value, NULL); Py_DECREF(value); - if (result == NULL) { - Py_XDECREF(fmt_spec); - ERROR_IF(true, error); - } - value = result; + ERROR_IF(res == NULL, error); } + else { + res = value; + } + } - result = PyObject_Format(value, fmt_spec); + inst(FORMAT_WITH_SPEC, (value, fmt_spec -- res)) { + res = PyObject_Format(value, fmt_spec); Py_DECREF(value); - Py_XDECREF(fmt_spec); - ERROR_IF(result == NULL, error); + Py_DECREF(fmt_spec); + ERROR_IF(res == NULL, error); } inst(COPY, (bottom, unused[oparg-1] -- bottom, unused[oparg-1], top)) { diff --git a/Python/ceval.c b/Python/ceval.c index e81b6beedfcee1..20b4ceee0c7f1b 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -219,6 +219,14 @@ _PyEvalFramePushAndInit_Ex(PyThreadState *tstate, PyFunctionObject *func, static void _PyEvalFrameClearAndPop(PyThreadState *tstate, _PyInterpreterFrame *frame); +typedef PyObject *(*convertion_func_ptr)(PyObject *); + +static const convertion_func_ptr CONVERSION_FUNCTIONS[4] = { + [FVC_STR] = PyObject_Str, + [FVC_REPR] = PyObject_Repr, + [FVC_ASCII] = PyObject_ASCII +}; + #define UNBOUNDLOCAL_ERROR_MSG \ "cannot access local variable '%s' where it is not associated with a value" #define UNBOUNDFREE_ERROR_MSG \ diff --git a/Python/compile.c b/Python/compile.c index 32431728422765..dffb78e6acf20b 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -4955,26 +4955,26 @@ compiler_formatted_value(struct compiler *c, expr_ty e) /* The expression to be formatted. */ VISIT(c, expr, e->v.FormattedValue.value); - switch (conversion) { - case 's': oparg = FVC_STR; break; - case 'r': oparg = FVC_REPR; break; - case 'a': oparg = FVC_ASCII; break; - case -1: oparg = FVC_NONE; break; - default: - PyErr_Format(PyExc_SystemError, + location loc = LOC(e); + if (conversion != -1) { + switch (conversion) { + case 's': oparg = FVC_STR; break; + case 'r': oparg = FVC_REPR; break; + case 'a': oparg = FVC_ASCII; break; + default: + PyErr_Format(PyExc_SystemError, "Unrecognized conversion character %d", conversion); - return ERROR; + return ERROR; + } + ADDOP_I(c, loc, CONVERT_VALUE, oparg); } if (e->v.FormattedValue.format_spec) { /* Evaluate the format spec, and update our opcode arg. */ VISIT(c, expr, e->v.FormattedValue.format_spec); - oparg |= FVS_HAVE_SPEC; + ADDOP(c, loc, FORMAT_WITH_SPEC); + } else { + ADDOP(c, loc, FORMAT_SIMPLE); } - - /* And push our opcode and oparg */ - location loc = LOC(e); - ADDOP_I(c, loc, FORMAT_VALUE, oparg); - return SUCCESS; } diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 8f61ec33fbaf75..93e46e9072dd5a 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -8,7 +8,7 @@ } TARGET(RESUME) { - #line 137 "Python/bytecodes.c" + #line 139 "Python/bytecodes.c" assert(tstate->cframe == &cframe); assert(frame == cframe.current_frame); /* Possibly combine this with eval breaker */ @@ -25,7 +25,7 @@ } TARGET(INSTRUMENTED_RESUME) { - #line 151 "Python/bytecodes.c" + #line 153 "Python/bytecodes.c" /* Possible performance enhancement: * We need to check the eval breaker anyway, can we * combine the instrument verison check and the eval breaker test? @@ -57,7 +57,7 @@ TARGET(LOAD_CLOSURE) { PyObject *value; - #line 179 "Python/bytecodes.c" + #line 181 "Python/bytecodes.c" /* We keep LOAD_CLOSURE so that the bytecode stays more readable. */ value = GETLOCAL(oparg); if (value == NULL) goto unbound_local_error; @@ -70,7 +70,7 @@ TARGET(LOAD_FAST_CHECK) { PyObject *value; - #line 186 "Python/bytecodes.c" + #line 188 "Python/bytecodes.c" value = GETLOCAL(oparg); if (value == NULL) goto unbound_local_error; Py_INCREF(value); @@ -82,7 +82,7 @@ TARGET(LOAD_FAST) { PyObject *value; - #line 192 "Python/bytecodes.c" + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); @@ -94,7 +94,7 @@ TARGET(LOAD_FAST_AND_CLEAR) { PyObject *value; - #line 198 "Python/bytecodes.c" + #line 200 "Python/bytecodes.c" value = GETLOCAL(oparg); // do not use SETLOCAL here, it decrefs the old value GETLOCAL(oparg) = NULL; @@ -107,7 +107,7 @@ TARGET(LOAD_FAST_LOAD_FAST) { PyObject *value1; PyObject *value2; - #line 204 "Python/bytecodes.c" + #line 206 "Python/bytecodes.c" uint32_t oparg1 = oparg >> 4; uint32_t oparg2 = oparg & 15; value1 = GETLOCAL(oparg1); @@ -123,7 +123,7 @@ TARGET(LOAD_CONST) { PyObject *value; - #line 213 "Python/bytecodes.c" + #line 215 "Python/bytecodes.c" value = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(value); #line 130 "Python/generated_cases.c.h" @@ -134,7 +134,7 @@ TARGET(STORE_FAST) { PyObject *value = stack_pointer[-1]; - #line 218 "Python/bytecodes.c" + #line 220 "Python/bytecodes.c" SETLOCAL(oparg, value); #line 140 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -144,7 +144,7 @@ TARGET(STORE_FAST_LOAD_FAST) { PyObject *value1 = stack_pointer[-1]; PyObject *value2; - #line 222 "Python/bytecodes.c" + #line 224 "Python/bytecodes.c" uint32_t oparg1 = oparg >> 4; uint32_t oparg2 = oparg & 15; SETLOCAL(oparg1, value1); @@ -158,7 +158,7 @@ TARGET(STORE_FAST_STORE_FAST) { PyObject *value1 = stack_pointer[-1]; PyObject *value2 = stack_pointer[-2]; - #line 230 "Python/bytecodes.c" + #line 232 "Python/bytecodes.c" uint32_t oparg1 = oparg >> 4; uint32_t oparg2 = oparg & 15; SETLOCAL(oparg1, value1); @@ -173,7 +173,7 @@ PyObject *_tmp_2; { PyObject *value; - #line 192 "Python/bytecodes.c" + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); @@ -183,7 +183,7 @@ oparg = (next_instr++)->op.arg; { PyObject *value; - #line 213 "Python/bytecodes.c" + #line 215 "Python/bytecodes.c" value = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(value); #line 190 "Python/generated_cases.c.h" @@ -200,7 +200,7 @@ PyObject *_tmp_2; { PyObject *value; - #line 213 "Python/bytecodes.c" + #line 215 "Python/bytecodes.c" value = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(value); #line 207 "Python/generated_cases.c.h" @@ -209,7 +209,7 @@ oparg = (next_instr++)->op.arg; { PyObject *value; - #line 192 "Python/bytecodes.c" + #line 194 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); @@ -224,7 +224,7 @@ TARGET(POP_TOP) { PyObject *value = stack_pointer[-1]; - #line 240 "Python/bytecodes.c" + #line 242 "Python/bytecodes.c" #line 229 "Python/generated_cases.c.h" Py_DECREF(value); STACK_SHRINK(1); @@ -233,7 +233,7 @@ TARGET(PUSH_NULL) { PyObject *res; - #line 244 "Python/bytecodes.c" + #line 246 "Python/bytecodes.c" res = NULL; #line 239 "Python/generated_cases.c.h" STACK_GROW(1); @@ -246,13 +246,13 @@ PyObject *_tmp_2 = stack_pointer[-2]; { PyObject *value = _tmp_1; - #line 240 "Python/bytecodes.c" + #line 242 "Python/bytecodes.c" #line 251 "Python/generated_cases.c.h" Py_DECREF(value); } { PyObject *value = _tmp_2; - #line 240 "Python/bytecodes.c" + #line 242 "Python/bytecodes.c" #line 257 "Python/generated_cases.c.h" Py_DECREF(value); } @@ -263,7 +263,7 @@ TARGET(INSTRUMENTED_END_FOR) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 250 "Python/bytecodes.c" + #line 252 "Python/bytecodes.c" /* Need to create a fake StopIteration error here, * to conform to PEP 380 */ if (PyGen_Check(receiver)) { @@ -283,7 +283,7 @@ TARGET(END_SEND) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 263 "Python/bytecodes.c" + #line 265 "Python/bytecodes.c" Py_DECREF(receiver); #line 289 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -294,7 +294,7 @@ TARGET(INSTRUMENTED_END_SEND) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 267 "Python/bytecodes.c" + #line 269 "Python/bytecodes.c" if (PyGen_Check(receiver) || PyCoro_CheckExact(receiver)) { PyErr_SetObject(PyExc_StopIteration, value); if (monitor_stop_iteration(tstate, frame, next_instr-1)) { @@ -312,11 +312,11 @@ TARGET(UNARY_NEGATIVE) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 278 "Python/bytecodes.c" + #line 280 "Python/bytecodes.c" res = PyNumber_Negative(value); #line 318 "Python/generated_cases.c.h" Py_DECREF(value); - #line 280 "Python/bytecodes.c" + #line 282 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; #line 322 "Python/generated_cases.c.h" stack_pointer[-1] = res; @@ -326,11 +326,11 @@ TARGET(UNARY_NOT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 284 "Python/bytecodes.c" + #line 286 "Python/bytecodes.c" int err = PyObject_IsTrue(value); #line 332 "Python/generated_cases.c.h" Py_DECREF(value); - #line 286 "Python/bytecodes.c" + #line 288 "Python/bytecodes.c" if (err < 0) goto pop_1_error; if (err == 0) { res = Py_True; @@ -346,11 +346,11 @@ TARGET(UNARY_INVERT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 296 "Python/bytecodes.c" + #line 298 "Python/bytecodes.c" res = PyNumber_Invert(value); #line 352 "Python/generated_cases.c.h" Py_DECREF(value); - #line 298 "Python/bytecodes.c" + #line 300 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; #line 356 "Python/generated_cases.c.h" stack_pointer[-1] = res; @@ -363,7 +363,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 314 "Python/bytecodes.c" + #line 316 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); #line 370 "Python/generated_cases.c.h" @@ -374,7 +374,7 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 319 "Python/bytecodes.c" + #line 321 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Multiply((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); @@ -395,7 +395,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 314 "Python/bytecodes.c" + #line 316 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); #line 402 "Python/generated_cases.c.h" @@ -406,7 +406,7 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 327 "Python/bytecodes.c" + #line 329 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Add((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); @@ -427,7 +427,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 314 "Python/bytecodes.c" + #line 316 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); #line 434 "Python/generated_cases.c.h" @@ -438,7 +438,7 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 335 "Python/bytecodes.c" + #line 337 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = _PyLong_Subtract((PyLongObject *)left, (PyLongObject *)right); _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); @@ -459,7 +459,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 350 "Python/bytecodes.c" + #line 352 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); #line 466 "Python/generated_cases.c.h" @@ -470,7 +470,7 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 355 "Python/bytecodes.c" + #line 357 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval * @@ -491,7 +491,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 350 "Python/bytecodes.c" + #line 352 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); #line 498 "Python/generated_cases.c.h" @@ -502,7 +502,7 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 363 "Python/bytecodes.c" + #line 365 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval + @@ -523,7 +523,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 350 "Python/bytecodes.c" + #line 352 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); #line 530 "Python/generated_cases.c.h" @@ -534,7 +534,7 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 371 "Python/bytecodes.c" + #line 373 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); double dres = ((PyFloatObject *)left)->ob_fval - @@ -555,7 +555,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 386 "Python/bytecodes.c" + #line 388 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); #line 562 "Python/generated_cases.c.h" @@ -566,7 +566,7 @@ PyObject *right = _tmp_1; PyObject *left = _tmp_2; PyObject *res; - #line 391 "Python/bytecodes.c" + #line 393 "Python/bytecodes.c" STAT_INC(BINARY_OP, hit); res = PyUnicode_Concat(left, right); _Py_DECREF_SPECIALIZED(left, _PyUnicode_ExactDealloc); @@ -587,7 +587,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 386 "Python/bytecodes.c" + #line 388 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(!PyUnicode_CheckExact(right), BINARY_OP); #line 594 "Python/generated_cases.c.h" @@ -597,7 +597,7 @@ { PyObject *right = _tmp_1; PyObject *left = _tmp_2; - #line 408 "Python/bytecodes.c" + #line 410 "Python/bytecodes.c" _Py_CODEUNIT true_next = next_instr[INLINE_CACHE_ENTRIES_BINARY_OP]; assert(true_next.op.code == STORE_FAST); PyObject **target_local = &GETLOCAL(true_next.op.arg); @@ -633,7 +633,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; PyObject *res; - #line 445 "Python/bytecodes.c" + #line 447 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinarySubscrCache *cache = (_PyBinarySubscrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -648,7 +648,7 @@ #line 649 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 457 "Python/bytecodes.c" + #line 459 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; #line 654 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -662,7 +662,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *res; - #line 461 "Python/bytecodes.c" + #line 463 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); // Can't use ERROR_IF() here, because we haven't // DECREF'ed container yet, and we still own slice. @@ -686,7 +686,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *v = stack_pointer[-4]; - #line 476 "Python/bytecodes.c" + #line 478 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); int err; if (slice == NULL) { @@ -708,7 +708,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *res; - #line 491 "Python/bytecodes.c" + #line 493 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), BINARY_SUBSCR); @@ -733,7 +733,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *tuple = stack_pointer[-2]; PyObject *res; - #line 507 "Python/bytecodes.c" + #line 509 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyTuple_CheckExact(tuple), BINARY_SUBSCR); @@ -758,7 +758,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *res; - #line 523 "Python/bytecodes.c" + #line 525 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), BINARY_SUBSCR); STAT_INC(BINARY_SUBSCR, hit); res = PyDict_GetItemWithError(dict, sub); @@ -769,7 +769,7 @@ #line 770 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); - #line 531 "Python/bytecodes.c" + #line 533 "Python/bytecodes.c" if (true) goto pop_2_error; } Py_INCREF(res); // Do this before DECREF'ing dict, sub @@ -785,7 +785,7 @@ TARGET(BINARY_SUBSCR_GETITEM) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 538 "Python/bytecodes.c" + #line 540 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, BINARY_SUBSCR); PyTypeObject *tp = Py_TYPE(container); DEOPT_IF(!PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE), BINARY_SUBSCR); @@ -814,7 +814,7 @@ TARGET(LIST_APPEND) { PyObject *v = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 563 "Python/bytecodes.c" + #line 565 "Python/bytecodes.c" if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error; #line 820 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -824,11 +824,11 @@ TARGET(SET_ADD) { PyObject *v = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 567 "Python/bytecodes.c" + #line 569 "Python/bytecodes.c" int err = PySet_Add(set, v); #line 830 "Python/generated_cases.c.h" Py_DECREF(v); - #line 569 "Python/bytecodes.c" + #line 571 "Python/bytecodes.c" if (err) goto pop_1_error; #line 834 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -842,7 +842,7 @@ PyObject *container = stack_pointer[-2]; PyObject *v = stack_pointer[-3]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 579 "Python/bytecodes.c" + #line 581 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr--; @@ -861,7 +861,7 @@ Py_DECREF(v); Py_DECREF(container); Py_DECREF(sub); - #line 594 "Python/bytecodes.c" + #line 596 "Python/bytecodes.c" if (err) goto pop_3_error; #line 867 "Python/generated_cases.c.h" STACK_SHRINK(3); @@ -873,7 +873,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 598 "Python/bytecodes.c" + #line 600 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), STORE_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), STORE_SUBSCR); @@ -900,7 +900,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 617 "Python/bytecodes.c" + #line 619 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), STORE_SUBSCR); STAT_INC(STORE_SUBSCR, hit); int err = _PyDict_SetItem_Take2((PyDictObject *)dict, sub, value); @@ -915,13 +915,13 @@ TARGET(DELETE_SUBSCR) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 625 "Python/bytecodes.c" + #line 627 "Python/bytecodes.c" /* del container[sub] */ int err = PyObject_DelItem(container, sub); #line 922 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 628 "Python/bytecodes.c" + #line 630 "Python/bytecodes.c" if (err) goto pop_2_error; #line 927 "Python/generated_cases.c.h" STACK_SHRINK(2); @@ -931,12 +931,12 @@ TARGET(CALL_INTRINSIC_1) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 632 "Python/bytecodes.c" + #line 634 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_1); res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value); #line 938 "Python/generated_cases.c.h" Py_DECREF(value); - #line 635 "Python/bytecodes.c" + #line 637 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; #line 942 "Python/generated_cases.c.h" stack_pointer[-1] = res; @@ -947,13 +947,13 @@ PyObject *value1 = stack_pointer[-1]; PyObject *value2 = stack_pointer[-2]; PyObject *res; - #line 639 "Python/bytecodes.c" + #line 641 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_2); res = _PyIntrinsics_BinaryFunctions[oparg](tstate, value2, value1); #line 954 "Python/generated_cases.c.h" Py_DECREF(value2); Py_DECREF(value1); - #line 642 "Python/bytecodes.c" + #line 644 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; #line 959 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -963,7 +963,7 @@ TARGET(RAISE_VARARGS) { PyObject **args = (stack_pointer - oparg); - #line 646 "Python/bytecodes.c" + #line 648 "Python/bytecodes.c" PyObject *cause = NULL, *exc = NULL; switch (oparg) { case 2: @@ -986,7 +986,7 @@ TARGET(INTERPRETER_EXIT) { PyObject *retval = stack_pointer[-1]; - #line 666 "Python/bytecodes.c" + #line 668 "Python/bytecodes.c" assert(frame == &entry_frame); assert(_PyFrame_IsIncomplete(frame)); STACK_SHRINK(1); // Since we're not going to DISPATCH() @@ -1002,7 +1002,7 @@ TARGET(RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 679 "Python/bytecodes.c" + #line 681 "Python/bytecodes.c" STACK_SHRINK(1); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -1020,7 +1020,7 @@ TARGET(INSTRUMENTED_RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 694 "Python/bytecodes.c" + #line 696 "Python/bytecodes.c" int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -1041,7 +1041,7 @@ } TARGET(RETURN_CONST) { - #line 713 "Python/bytecodes.c" + #line 715 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(retval); assert(EMPTY()); @@ -1059,7 +1059,7 @@ } TARGET(INSTRUMENTED_RETURN_CONST) { - #line 729 "Python/bytecodes.c" + #line 731 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, @@ -1083,7 +1083,7 @@ TARGET(GET_AITER) { PyObject *obj = stack_pointer[-1]; PyObject *iter; - #line 749 "Python/bytecodes.c" + #line 751 "Python/bytecodes.c" unaryfunc getter = NULL; PyTypeObject *type = Py_TYPE(obj); @@ -1098,14 +1098,14 @@ type->tp_name); #line 1100 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 762 "Python/bytecodes.c" + #line 764 "Python/bytecodes.c" if (true) goto pop_1_error; } iter = (*getter)(obj); #line 1107 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 767 "Python/bytecodes.c" + #line 769 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; if (Py_TYPE(iter)->tp_as_async == NULL || @@ -1126,7 +1126,7 @@ TARGET(GET_ANEXT) { PyObject *aiter = stack_pointer[-1]; PyObject *awaitable; - #line 782 "Python/bytecodes.c" + #line 784 "Python/bytecodes.c" unaryfunc getter = NULL; PyObject *next_iter = NULL; PyTypeObject *type = Py_TYPE(aiter); @@ -1178,7 +1178,7 @@ TARGET(GET_AWAITABLE) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 827 "Python/bytecodes.c" + #line 829 "Python/bytecodes.c" iter = _PyCoro_GetAwaitableIter(iterable); if (iter == NULL) { @@ -1187,7 +1187,7 @@ #line 1189 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 834 "Python/bytecodes.c" + #line 836 "Python/bytecodes.c" if (iter != NULL && PyCoro_CheckExact(iter)) { PyObject *yf = _PyGen_yf((PyGenObject*)iter); @@ -1215,7 +1215,7 @@ PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; PyObject *retval; - #line 858 "Python/bytecodes.c" + #line 860 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PySendCache *cache = (_PySendCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1271,7 +1271,7 @@ TARGET(SEND_GEN) { PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 907 "Python/bytecodes.c" + #line 909 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, SEND); PyGenObject *gen = (PyGenObject *)receiver; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type && @@ -1292,7 +1292,7 @@ TARGET(INSTRUMENTED_YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 925 "Python/bytecodes.c" + #line 927 "Python/bytecodes.c" assert(frame != &entry_frame); PyGenObject *gen = _PyFrame_GetGenerator(frame); gen->gi_frame_state = FRAME_SUSPENDED; @@ -1314,7 +1314,7 @@ TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 944 "Python/bytecodes.c" + #line 946 "Python/bytecodes.c" // NOTE: It's important that YIELD_VALUE never raises an exception! // The compiler treats any exception raised here as a failed close() // or throw() call. @@ -1335,7 +1335,7 @@ TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; - #line 962 "Python/bytecodes.c" + #line 964 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); #line 1342 "Python/generated_cases.c.h" @@ -1346,7 +1346,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); - #line 967 "Python/bytecodes.c" + #line 969 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1370,13 +1370,13 @@ TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 987 "Python/bytecodes.c" + #line 989 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { #line 1377 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 990 "Python/bytecodes.c" + #line 992 "Python/bytecodes.c" } else { Py_INCREF(exc); @@ -1394,7 +1394,7 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 999 "Python/bytecodes.c" + #line 1001 "Python/bytecodes.c" assert(throwflag); assert(exc_value && PyExceptionInstance_Check(exc_value)); if (PyErr_GivenExceptionMatches(exc_value, PyExc_StopIteration)) { @@ -1403,7 +1403,7 @@ Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 1004 "Python/bytecodes.c" + #line 1006 "Python/bytecodes.c" none = Py_None; } else { @@ -1419,7 +1419,7 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 1013 "Python/bytecodes.c" + #line 1015 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); #line 1425 "Python/generated_cases.c.h" STACK_GROW(1); @@ -1429,7 +1429,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 1017 "Python/bytecodes.c" + #line 1019 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1459,7 +1459,7 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 1042 "Python/bytecodes.c" + #line 1044 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; @@ -1468,7 +1468,7 @@ "no locals found when storing %R", name); #line 1470 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1049 "Python/bytecodes.c" + #line 1051 "Python/bytecodes.c" if (true) goto pop_1_error; } if (PyDict_CheckExact(ns)) @@ -1477,7 +1477,7 @@ err = PyObject_SetItem(ns, name, v); #line 1479 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1056 "Python/bytecodes.c" + #line 1058 "Python/bytecodes.c" if (err) goto pop_1_error; #line 1483 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -1485,7 +1485,7 @@ } TARGET(DELETE_NAME) { - #line 1060 "Python/bytecodes.c" + #line 1062 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; @@ -1510,7 +1510,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 1086 "Python/bytecodes.c" + #line 1088 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1525,7 +1525,7 @@ int res = unpack_iterable(tstate, seq, oparg, -1, top); #line 1527 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1099 "Python/bytecodes.c" + #line 1101 "Python/bytecodes.c" if (res == 0) goto pop_1_error; #line 1531 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -1537,7 +1537,7 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1103 "Python/bytecodes.c" + #line 1105 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != 2, UNPACK_SEQUENCE); assert(oparg == 2); @@ -1555,7 +1555,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1113 "Python/bytecodes.c" + #line 1115 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1574,7 +1574,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1124 "Python/bytecodes.c" + #line 1126 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1592,13 +1592,13 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 1135 "Python/bytecodes.c" + #line 1137 "Python/bytecodes.c" int totalargs = 1 + (oparg & 0xFF) + (oparg >> 8); PyObject **top = stack_pointer + totalargs - 1; int res = unpack_iterable(tstate, seq, oparg & 0xFF, oparg >> 8, top); #line 1600 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1139 "Python/bytecodes.c" + #line 1141 "Python/bytecodes.c" if (res == 0) goto pop_1_error; #line 1604 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); @@ -1611,7 +1611,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 1150 "Python/bytecodes.c" + #line 1152 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(frame->f_code->co_names, oparg); @@ -1630,7 +1630,7 @@ #line 1631 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 1166 "Python/bytecodes.c" + #line 1168 "Python/bytecodes.c" if (err) goto pop_2_error; #line 1636 "Python/generated_cases.c.h" STACK_SHRINK(2); @@ -1640,12 +1640,12 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 1170 "Python/bytecodes.c" + #line 1172 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); #line 1647 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1173 "Python/bytecodes.c" + #line 1175 "Python/bytecodes.c" if (err) goto pop_1_error; #line 1651 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -1654,12 +1654,12 @@ TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 1177 "Python/bytecodes.c" + #line 1179 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); #line 1661 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1180 "Python/bytecodes.c" + #line 1182 "Python/bytecodes.c" if (err) goto pop_1_error; #line 1665 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -1667,7 +1667,7 @@ } TARGET(DELETE_GLOBAL) { - #line 1184 "Python/bytecodes.c" + #line 1186 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1687,7 +1687,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1198 "Python/bytecodes.c" + #line 1200 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1707,7 +1707,7 @@ PyObject *_tmp_1; { PyObject *locals; - #line 1198 "Python/bytecodes.c" + #line 1200 "Python/bytecodes.c" locals = LOCALS(); if (locals == NULL) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -1721,7 +1721,7 @@ { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1210 "Python/bytecodes.c" + #line 1212 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1791,7 +1791,7 @@ { PyObject *mod_or_class_dict = _tmp_1; PyObject *v; - #line 1210 "Python/bytecodes.c" + #line 1212 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); if (PyDict_CheckExact(mod_or_class_dict)) { v = PyDict_GetItemWithError(mod_or_class_dict, name); @@ -1860,7 +1860,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1279 "Python/bytecodes.c" + #line 1281 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1926,7 +1926,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1333 "Python/bytecodes.c" + #line 1335 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -1952,7 +1952,7 @@ uint16_t index = read_u16(&next_instr[1].cache); uint16_t mod_version = read_u16(&next_instr[2].cache); uint16_t bltn_version = read_u16(&next_instr[3].cache); - #line 1346 "Python/bytecodes.c" + #line 1348 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -1977,7 +1977,7 @@ } TARGET(DELETE_FAST) { - #line 1363 "Python/bytecodes.c" + #line 1365 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); @@ -1986,7 +1986,7 @@ } TARGET(MAKE_CELL) { - #line 1369 "Python/bytecodes.c" + #line 1371 "Python/bytecodes.c" // "initial" is probably NULL but not if it's an arg (or set // via PyFrame_LocalsToFast() before MAKE_CELL has run). PyObject *initial = GETLOCAL(oparg); @@ -2000,7 +2000,7 @@ } TARGET(DELETE_DEREF) { - #line 1380 "Python/bytecodes.c" + #line 1382 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -2018,7 +2018,7 @@ TARGET(LOAD_FROM_DICT_OR_DEREF) { PyObject *class_dict = stack_pointer[-1]; PyObject *value; - #line 1393 "Python/bytecodes.c" + #line 1395 "Python/bytecodes.c" PyObject *name; assert(class_dict); assert(oparg >= 0 && oparg < frame->f_code->co_nlocalsplus); @@ -2060,7 +2060,7 @@ TARGET(LOAD_DEREF) { PyObject *value; - #line 1430 "Python/bytecodes.c" + #line 1432 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -2076,7 +2076,7 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1440 "Python/bytecodes.c" + #line 1442 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); @@ -2087,7 +2087,7 @@ } TARGET(COPY_FREE_VARS) { - #line 1447 "Python/bytecodes.c" + #line 1449 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = frame->f_code; assert(PyFunction_Check(frame->f_funcobj)); @@ -2105,13 +2105,13 @@ TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1460 "Python/bytecodes.c" + #line 1462 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); #line 2111 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1462 "Python/bytecodes.c" + #line 1464 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } #line 2117 "Python/generated_cases.c.h" STACK_SHRINK(oparg); @@ -2123,7 +2123,7 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1466 "Python/bytecodes.c" + #line 1468 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } #line 2130 "Python/generated_cases.c.h" @@ -2136,7 +2136,7 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1471 "Python/bytecodes.c" + #line 1473 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } #line 2143 "Python/generated_cases.c.h" @@ -2149,7 +2149,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1476 "Python/bytecodes.c" + #line 1478 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -2162,7 +2162,7 @@ } #line 2164 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1487 "Python/bytecodes.c" + #line 1489 "Python/bytecodes.c" if (true) goto pop_1_error; } assert(Py_IsNone(none_val)); @@ -2175,11 +2175,11 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1494 "Python/bytecodes.c" + #line 1496 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); #line 2181 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1496 "Python/bytecodes.c" + #line 1498 "Python/bytecodes.c" if (err < 0) goto pop_1_error; #line 2185 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -2189,7 +2189,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1500 "Python/bytecodes.c" + #line 1502 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -2214,7 +2214,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1517 "Python/bytecodes.c" + #line 1519 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -2226,7 +2226,7 @@ for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1525 "Python/bytecodes.c" + #line 1527 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } #line 2232 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); @@ -2236,7 +2236,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1529 "Python/bytecodes.c" + #line 1531 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -2284,7 +2284,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1571 "Python/bytecodes.c" + #line 1573 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -2299,7 +2299,7 @@ Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1581 "Python/bytecodes.c" + #line 1583 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } #line 2305 "Python/generated_cases.c.h" STACK_SHRINK(oparg); @@ -2309,7 +2309,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1585 "Python/bytecodes.c" + #line 1587 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (PyDict_Update(dict, update) < 0) { if (_PyErr_ExceptionMatches(tstate, PyExc_AttributeError)) { @@ -2319,7 +2319,7 @@ } #line 2321 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1593 "Python/bytecodes.c" + #line 1595 "Python/bytecodes.c" if (true) goto pop_1_error; } #line 2326 "Python/generated_cases.c.h" @@ -2330,14 +2330,14 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1599 "Python/bytecodes.c" + #line 1601 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 1); // update is still on the stack if (_PyDict_MergeEx(dict, update, 2) < 0) { format_kwargs_error(tstate, PEEK(3 + oparg), update); #line 2339 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1604 "Python/bytecodes.c" + #line 1606 "Python/bytecodes.c" if (true) goto pop_1_error; } #line 2344 "Python/generated_cases.c.h" @@ -2349,7 +2349,7 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1610 "Python/bytecodes.c" + #line 1612 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 2); // key, value are still on the stack assert(PyDict_CheckExact(dict)); /* dict[key] = value */ @@ -2361,7 +2361,7 @@ } TARGET(INSTRUMENTED_LOAD_SUPER_ATTR) { - #line 1618 "Python/bytecodes.c" + #line 1620 "Python/bytecodes.c" _PySuperAttrCache *cache = (_PySuperAttrCache *)next_instr; // cancel out the decrement that will happen in LOAD_SUPER_ATTR; we // don't want to specialize instrumented instructions @@ -2378,7 +2378,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1632 "Python/bytecodes.c" + #line 1634 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); int load_method = oparg & 1; #if ENABLE_SPECIALIZATION @@ -2424,7 +2424,7 @@ Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1674 "Python/bytecodes.c" + #line 1676 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); @@ -2444,7 +2444,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; - #line 1681 "Python/bytecodes.c" + #line 1683 "Python/bytecodes.c" assert(!(oparg & 1)); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); @@ -2455,7 +2455,7 @@ Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1688 "Python/bytecodes.c" + #line 1690 "Python/bytecodes.c" if (res == NULL) goto pop_3_error; #line 2461 "Python/generated_cases.c.h" STACK_SHRINK(2); @@ -2472,7 +2472,7 @@ PyObject *global_super = stack_pointer[-3]; PyObject *res2; PyObject *res; - #line 1692 "Python/bytecodes.c" + #line 1694 "Python/bytecodes.c" assert(oparg & 1); DEOPT_IF(global_super != (PyObject *)&PySuper_Type, LOAD_SUPER_ATTR); DEOPT_IF(!PyType_Check(class), LOAD_SUPER_ATTR); @@ -2509,7 +2509,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1731 "Python/bytecodes.c" + #line 1733 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2545,7 +2545,7 @@ */ #line 2547 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1765 "Python/bytecodes.c" + #line 1767 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2556,7 +2556,7 @@ res = PyObject_GetAttr(owner, name); #line 2558 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1774 "Python/bytecodes.c" + #line 1776 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } #line 2563 "Python/generated_cases.c.h" @@ -2573,7 +2573,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1779 "Python/bytecodes.c" + #line 1781 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2601,7 +2601,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1795 "Python/bytecodes.c" + #line 1797 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2629,7 +2629,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1811 "Python/bytecodes.c" + #line 1813 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2671,7 +2671,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1841 "Python/bytecodes.c" + #line 1843 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2696,7 +2696,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1854 "Python/bytecodes.c" + #line 1856 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2722,7 +2722,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *fget = read_obj(&next_instr[5].cache); - #line 1869 "Python/bytecodes.c" + #line 1871 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2754,7 +2754,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t func_version = read_u32(&next_instr[3].cache); PyObject *getattribute = read_obj(&next_instr[5].cache); - #line 1895 "Python/bytecodes.c" + #line 1897 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); DEOPT_IF(cls->tp_version_tag != type_version, LOAD_ATTR); @@ -2788,7 +2788,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1923 "Python/bytecodes.c" + #line 1925 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2817,7 +2817,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t hint = read_u16(&next_instr[3].cache); - #line 1943 "Python/bytecodes.c" + #line 1945 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2867,7 +2867,7 @@ PyObject *value = stack_pointer[-2]; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1984 "Python/bytecodes.c" + #line 1986 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2889,7 +2889,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2003 "Python/bytecodes.c" + #line 2005 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2905,7 +2905,7 @@ #line 2906 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2016 "Python/bytecodes.c" + #line 2018 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; #line 2911 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -2918,7 +2918,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2020 "Python/bytecodes.c" + #line 2022 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2940,7 +2940,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2034 "Python/bytecodes.c" + #line 2036 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyLong_CheckExact(right), COMPARE_OP); DEOPT_IF(!_PyLong_IsCompact((PyLongObject *)left), COMPARE_OP); @@ -2966,7 +2966,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 2052 "Python/bytecodes.c" + #line 2054 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2989,12 +2989,12 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2066 "Python/bytecodes.c" + #line 2068 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; #line 2995 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2068 "Python/bytecodes.c" + #line 2070 "Python/bytecodes.c" b = res ? Py_True : Py_False; #line 3000 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -3006,12 +3006,12 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2072 "Python/bytecodes.c" + #line 2074 "Python/bytecodes.c" int res = PySequence_Contains(right, left); #line 3012 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 2074 "Python/bytecodes.c" + #line 2076 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = (res ^ oparg) ? Py_True : Py_False; #line 3018 "Python/generated_cases.c.h" @@ -3025,12 +3025,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 2079 "Python/bytecodes.c" + #line 2081 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { #line 3031 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2081 "Python/bytecodes.c" + #line 2083 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -3041,7 +3041,7 @@ #line 3042 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 2089 "Python/bytecodes.c" + #line 2091 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -3060,19 +3060,19 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 2100 "Python/bytecodes.c" + #line 2102 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { #line 3067 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2103 "Python/bytecodes.c" + #line 2105 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); #line 3074 "Python/generated_cases.c.h" Py_DECREF(right); - #line 2108 "Python/bytecodes.c" + #line 2110 "Python/bytecodes.c" b = res ? Py_True : Py_False; #line 3078 "Python/generated_cases.c.h" stack_pointer[-1] = b; @@ -3083,13 +3083,13 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 2112 "Python/bytecodes.c" + #line 2114 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_name(tstate, frame, name, fromlist, level); #line 3090 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 2115 "Python/bytecodes.c" + #line 2117 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; #line 3095 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -3100,7 +3100,7 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 2119 "Python/bytecodes.c" + #line 2121 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; @@ -3111,14 +3111,14 @@ } TARGET(JUMP_FORWARD) { - #line 2125 "Python/bytecodes.c" + #line 2127 "Python/bytecodes.c" JUMPBY(oparg); #line 3117 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { - #line 2129 "Python/bytecodes.c" + #line 2131 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr - 1; assert(oparg <= INSTR_OFFSET()); JUMPBY(1-oparg); @@ -3141,7 +3141,7 @@ } TARGET(ENTER_EXECUTOR) { - #line 2149 "Python/bytecodes.c" + #line 2151 "Python/bytecodes.c" _PyExecutorObject *executor = (_PyExecutorObject *)frame->f_code->co_executors->executors[oparg]; Py_INCREF(executor); frame = executor->execute(executor, frame, stack_pointer); @@ -3155,7 +3155,7 @@ TARGET(POP_JUMP_IF_FALSE) { PyObject *cond = stack_pointer[-1]; - #line 2160 "Python/bytecodes.c" + #line 2162 "Python/bytecodes.c" if (Py_IsFalse(cond)) { JUMPBY(oparg); } @@ -3163,7 +3163,7 @@ int err = PyObject_IsTrue(cond); #line 3165 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2166 "Python/bytecodes.c" + #line 2168 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -3178,7 +3178,7 @@ TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2176 "Python/bytecodes.c" + #line 2178 "Python/bytecodes.c" if (Py_IsTrue(cond)) { JUMPBY(oparg); } @@ -3186,7 +3186,7 @@ int err = PyObject_IsTrue(cond); #line 3188 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2182 "Python/bytecodes.c" + #line 2184 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -3201,11 +3201,11 @@ TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2192 "Python/bytecodes.c" + #line 2194 "Python/bytecodes.c" if (!Py_IsNone(value)) { #line 3207 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2194 "Python/bytecodes.c" + #line 2196 "Python/bytecodes.c" JUMPBY(oparg); } #line 3212 "Python/generated_cases.c.h" @@ -3215,14 +3215,14 @@ TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2199 "Python/bytecodes.c" + #line 2201 "Python/bytecodes.c" if (Py_IsNone(value)) { JUMPBY(oparg); } else { #line 3224 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2204 "Python/bytecodes.c" + #line 2206 "Python/bytecodes.c" } #line 3228 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -3230,7 +3230,7 @@ } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2208 "Python/bytecodes.c" + #line 2210 "Python/bytecodes.c" /* This bytecode is used in the `yield from` or `await` loop. * If there is an interrupt, we want it handled in the innermost * generator or coroutine, so we deliberately do not check it here. @@ -3244,7 +3244,7 @@ TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2217 "Python/bytecodes.c" + #line 2219 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; @@ -3261,7 +3261,7 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2225 "Python/bytecodes.c" + #line 2227 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); @@ -3270,7 +3270,7 @@ Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2230 "Python/bytecodes.c" + #line 2232 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -3287,7 +3287,7 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2240 "Python/bytecodes.c" + #line 2242 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = match ? Py_True : Py_False; #line 3294 "Python/generated_cases.c.h" @@ -3299,7 +3299,7 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2245 "Python/bytecodes.c" + #line 2247 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = match ? Py_True : Py_False; #line 3306 "Python/generated_cases.c.h" @@ -3312,7 +3312,7 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2250 "Python/bytecodes.c" + #line 2252 "Python/bytecodes.c" // On successful match, PUSH(values). Otherwise, PUSH(None). values_or_none = match_keys(tstate, subject, keys); if (values_or_none == NULL) goto error; @@ -3325,12 +3325,12 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2256 "Python/bytecodes.c" + #line 2258 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); #line 3332 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2259 "Python/bytecodes.c" + #line 2261 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; #line 3336 "Python/generated_cases.c.h" stack_pointer[-1] = iter; @@ -3340,7 +3340,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2263 "Python/bytecodes.c" + #line 2265 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3365,7 +3365,7 @@ } #line 3367 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2286 "Python/bytecodes.c" + #line 2288 "Python/bytecodes.c" } #line 3371 "Python/generated_cases.c.h" stack_pointer[-1] = iter; @@ -3377,7 +3377,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2304 "Python/bytecodes.c" + #line 2306 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3416,7 +3416,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2337 "Python/bytecodes.c" + #line 2339 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3449,7 +3449,7 @@ TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2365 "Python/bytecodes.c" + #line 2367 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3479,7 +3479,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2387 "Python/bytecodes.c" + #line 2389 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3509,7 +3509,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2409 "Python/bytecodes.c" + #line 2411 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3536,7 +3536,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2429 "Python/bytecodes.c" + #line 2431 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, FOR_ITER); PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); @@ -3559,7 +3559,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2447 "Python/bytecodes.c" + #line 2449 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3584,7 +3584,7 @@ } #line 3586 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2470 "Python/bytecodes.c" + #line 2472 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { @@ -3602,7 +3602,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2479 "Python/bytecodes.c" + #line 2481 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3630,7 +3630,7 @@ } #line 3632 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2505 "Python/bytecodes.c" + #line 2507 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { @@ -3649,7 +3649,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2514 "Python/bytecodes.c" + #line 2516 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3679,7 +3679,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2537 "Python/bytecodes.c" + #line 2539 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3703,7 +3703,7 @@ uint32_t type_version = read_u32(&next_instr[1].cache); uint32_t keys_version = read_u32(&next_instr[3].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2549 "Python/bytecodes.c" + #line 2551 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3734,7 +3734,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2568 "Python/bytecodes.c" + #line 2570 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); assert(self_cls->tp_dictoffset == 0); @@ -3758,7 +3758,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2580 "Python/bytecodes.c" + #line 2582 "Python/bytecodes.c" PyTypeObject *self_cls = Py_TYPE(self); DEOPT_IF(self_cls->tp_version_tag != type_version, LOAD_ATTR); Py_ssize_t dictoffset = self_cls->tp_dictoffset; @@ -3781,7 +3781,7 @@ } TARGET(KW_NAMES) { - #line 2596 "Python/bytecodes.c" + #line 2598 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(frame->f_code->co_consts)); kwnames = GETITEM(frame->f_code->co_consts, oparg); @@ -3790,7 +3790,7 @@ } TARGET(INSTRUMENTED_CALL) { - #line 2602 "Python/bytecodes.c" + #line 2604 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3813,7 +3813,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2647 "Python/bytecodes.c" + #line 2649 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3907,7 +3907,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2735 "Python/bytecodes.c" + #line 2737 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3926,7 +3926,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2747 "Python/bytecodes.c" + #line 2749 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3960,7 +3960,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2775 "Python/bytecodes.c" + #line 2777 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -4004,7 +4004,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2813 "Python/bytecodes.c" + #line 2815 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4027,7 +4027,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2825 "Python/bytecodes.c" + #line 2827 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4052,7 +4052,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2839 "Python/bytecodes.c" + #line 2841 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -4077,7 +4077,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2853 "Python/bytecodes.c" + #line 2855 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4113,7 +4113,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2878 "Python/bytecodes.c" + #line 2880 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4155,7 +4155,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2909 "Python/bytecodes.c" + #line 2911 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -4201,7 +4201,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2944 "Python/bytecodes.c" + #line 2946 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -4247,7 +4247,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2979 "Python/bytecodes.c" + #line 2981 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -4285,7 +4285,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3006 "Python/bytecodes.c" + #line 3008 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4324,7 +4324,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 3036 "Python/bytecodes.c" + #line 3038 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4349,7 +4349,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3056 "Python/bytecodes.c" + #line 3058 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4393,7 +4393,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3090 "Python/bytecodes.c" + #line 3092 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4435,7 +4435,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3122 "Python/bytecodes.c" + #line 3124 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4477,7 +4477,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3154 "Python/bytecodes.c" + #line 3156 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4515,7 +4515,7 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3185 "Python/bytecodes.c" + #line 3187 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); #line 4521 "Python/generated_cases.c.h" } @@ -4526,7 +4526,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3189 "Python/bytecodes.c" + #line 3191 "Python/bytecodes.c" // DICT_MERGE is called before this opcode if there are kwargs. // It converts all dict subtypes in kwargs into regular dicts. assert(kwargs == NULL || PyDict_CheckExact(kwargs)); @@ -4592,7 +4592,7 @@ Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3251 "Python/bytecodes.c" + #line 3253 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } #line 4599 "Python/generated_cases.c.h" @@ -4610,7 +4610,7 @@ PyObject *kwdefaults = (oparg & MAKE_FUNCTION_KWDEFAULTS) ? stack_pointer[-(1 + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0))] : NULL; PyObject *defaults = (oparg & MAKE_FUNCTION_DEFAULTS) ? stack_pointer[-(1 + ((oparg & MAKE_FUNCTION_CLOSURE) ? 1 : 0) + ((oparg & MAKE_FUNCTION_ANNOTATIONS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_KWDEFAULTS) ? 1 : 0) + ((oparg & MAKE_FUNCTION_DEFAULTS) ? 1 : 0))] : NULL; PyObject *func; - #line 3261 "Python/bytecodes.c" + #line 3263 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4646,7 +4646,7 @@ } TARGET(RETURN_GENERATOR) { - #line 3292 "Python/bytecodes.c" + #line 3294 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4675,13 +4675,13 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3315 "Python/bytecodes.c" + #line 3317 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); #line 4681 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3317 "Python/bytecodes.c" + #line 3319 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } #line 4687 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); @@ -4690,58 +4690,62 @@ DISPATCH(); } - TARGET(FORMAT_VALUE) { - PyObject *fmt_spec = ((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? stack_pointer[-((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0))] : NULL; - PyObject *value = stack_pointer[-(1 + (((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0))]; + TARGET(CONVERT_VALUE) { + PyObject *value = stack_pointer[-1]; PyObject *result; - #line 3321 "Python/bytecodes.c" - /* Handles f-string value formatting. */ - PyObject *(*conv_fn)(PyObject *); - int which_conversion = oparg & FVC_MASK; - - /* See if any conversion is specified. */ - switch (which_conversion) { - case FVC_NONE: conv_fn = NULL; break; - case FVC_STR: conv_fn = PyObject_Str; break; - case FVC_REPR: conv_fn = PyObject_Repr; break; - case FVC_ASCII: conv_fn = PyObject_ASCII; break; - default: - _PyErr_Format(tstate, PyExc_SystemError, - "unexpected conversion flag %d", - which_conversion); - goto error; - } + #line 3323 "Python/bytecodes.c" + convertion_func_ptr conv_fn; + assert(oparg >= FVC_STR && oparg <= FVC_ASCII); + conv_fn = CONVERSION_FUNCTIONS[oparg]; + result = conv_fn(value); + Py_DECREF(value); + if (result == NULL) goto pop_1_error; + #line 4704 "Python/generated_cases.c.h" + stack_pointer[-1] = result; + DISPATCH(); + } - /* If there's a conversion function, call it and replace - value with that result. Otherwise, just use value, - without conversion. */ - if (conv_fn != NULL) { - result = conv_fn(value); + TARGET(FORMAT_SIMPLE) { + PyObject *value = stack_pointer[-1]; + PyObject *res; + #line 3332 "Python/bytecodes.c" + /* If value is a unicode object, then we know the result + * of format(value) is value itself. */ + if (!PyUnicode_CheckExact(value)) { + res = PyObject_Format(value, NULL); Py_DECREF(value); - if (result == NULL) { - Py_XDECREF(fmt_spec); - if (true) { STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); goto pop_1_error; } - } - value = result; + if (res == NULL) goto pop_1_error; } + else { + res = value; + } + #line 4723 "Python/generated_cases.c.h" + stack_pointer[-1] = res; + DISPATCH(); + } - result = PyObject_Format(value, fmt_spec); + TARGET(FORMAT_WITH_SPEC) { + PyObject *fmt_spec = stack_pointer[-1]; + PyObject *value = stack_pointer[-2]; + PyObject *res; + #line 3345 "Python/bytecodes.c" + res = PyObject_Format(value, fmt_spec); Py_DECREF(value); - Py_XDECREF(fmt_spec); - if (result == NULL) { STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); goto pop_1_error; } - #line 4733 "Python/generated_cases.c.h" - STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); - stack_pointer[-1] = result; + Py_DECREF(fmt_spec); + if (res == NULL) goto pop_2_error; + #line 4737 "Python/generated_cases.c.h" + STACK_SHRINK(1); + stack_pointer[-1] = res; DISPATCH(); } TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3358 "Python/bytecodes.c" + #line 3352 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4745 "Python/generated_cases.c.h" + #line 4749 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4753,7 +4757,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3363 "Python/bytecodes.c" + #line 3357 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4768,12 +4772,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4772 "Python/generated_cases.c.h" + #line 4776 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3378 "Python/bytecodes.c" + #line 3372 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4777 "Python/generated_cases.c.h" + #line 4781 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4783,16 +4787,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3383 "Python/bytecodes.c" + #line 3377 "Python/bytecodes.c" assert(oparg >= 2); - #line 4789 "Python/generated_cases.c.h" + #line 4793 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3387 "Python/bytecodes.c" + #line 3381 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4804,26 +4808,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4808 "Python/generated_cases.c.h" + #line 4812 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3401 "Python/bytecodes.c" + #line 3395 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4814 "Python/generated_cases.c.h" + #line 4818 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3405 "Python/bytecodes.c" + #line 3399 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+1-oparg, PY_MONITORING_EVENT_JUMP); - #line 4821 "Python/generated_cases.c.h" + #line 4825 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3410 "Python/bytecodes.c" + #line 3404 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4832,12 +4836,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4836 "Python/generated_cases.c.h" + #line 4840 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3421 "Python/bytecodes.c" + #line 3415 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4846,12 +4850,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4850 "Python/generated_cases.c.h" + #line 4854 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3432 "Python/bytecodes.c" + #line 3426 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4863,12 +4867,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4867 "Python/generated_cases.c.h" + #line 4871 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3446 "Python/bytecodes.c" + #line 3440 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4880,30 +4884,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4884 "Python/generated_cases.c.h" + #line 4888 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3460 "Python/bytecodes.c" + #line 3454 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4895 "Python/generated_cases.c.h" + #line 4899 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3468 "Python/bytecodes.c" + #line 3462 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4902 "Python/generated_cases.c.h" + #line 4906 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3473 "Python/bytecodes.c" + #line 3467 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4909 "Python/generated_cases.c.h" + #line 4913 "Python/generated_cases.c.h" } diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h index ce9c2e7b25a3a8..20b037fbdd519b 100644 --- a/Python/opcode_metadata.h +++ b/Python/opcode_metadata.h @@ -367,8 +367,12 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) { return 0; case BUILD_SLICE: return ((oparg == 3) ? 1 : 0) + 2; - case FORMAT_VALUE: - return (((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0) + 1; + case CONVERT_VALUE: + return 1; + case FORMAT_SIMPLE: + return 1; + case FORMAT_WITH_SPEC: + return 2; case COPY: return (oparg-1) + 1; case BINARY_OP: @@ -765,7 +769,11 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { return 0; case BUILD_SLICE: return 1; - case FORMAT_VALUE: + case CONVERT_VALUE: + return 1; + case FORMAT_SIMPLE: + return 1; + case FORMAT_WITH_SPEC: return 1; case COPY: return (oparg-1) + 2; @@ -988,7 +996,9 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { [MAKE_FUNCTION] = { true, INSTR_FMT_IB }, [RETURN_GENERATOR] = { true, INSTR_FMT_IX }, [BUILD_SLICE] = { true, INSTR_FMT_IB }, - [FORMAT_VALUE] = { true, INSTR_FMT_IB }, + [CONVERT_VALUE] = { true, INSTR_FMT_IB }, + [FORMAT_SIMPLE] = { true, INSTR_FMT_IX }, + [FORMAT_WITH_SPEC] = { true, INSTR_FMT_IX }, [COPY] = { true, INSTR_FMT_IB }, [BINARY_OP] = { true, INSTR_FMT_IBC }, [SWAP] = { true, INSTR_FMT_IB }, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 8835ad984c19b7..853bee51e86bf4 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -39,6 +39,8 @@ static void *opcode_targets[256] = { &&TARGET_CHECK_EG_MATCH, &&TARGET_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS, &&TARGET_CALL_NO_KW_BUILTIN_FAST, + &&TARGET_FORMAT_SIMPLE, + &&TARGET_FORMAT_WITH_SPEC, &&TARGET_CALL_NO_KW_BUILTIN_O, &&TARGET_CALL_NO_KW_ISINSTANCE, &&TARGET_CALL_NO_KW_LEN, @@ -46,8 +48,6 @@ static void *opcode_targets[256] = { &&TARGET_CALL_NO_KW_METHOD_DESCRIPTOR_FAST, &&TARGET_CALL_NO_KW_METHOD_DESCRIPTOR_NOARGS, &&TARGET_CALL_NO_KW_METHOD_DESCRIPTOR_O, - &&TARGET_CALL_NO_KW_STR_1, - &&TARGET_CALL_NO_KW_TUPLE_1, &&TARGET_WITH_EXCEPT_START, &&TARGET_GET_AITER, &&TARGET_GET_ANEXT, @@ -55,39 +55,39 @@ static void *opcode_targets[256] = { &&TARGET_BEFORE_WITH, &&TARGET_END_ASYNC_FOR, &&TARGET_CLEANUP_THROW, + &&TARGET_CALL_NO_KW_STR_1, + &&TARGET_CALL_NO_KW_TUPLE_1, &&TARGET_CALL_NO_KW_TYPE_1, &&TARGET_COMPARE_OP_FLOAT, - &&TARGET_COMPARE_OP_INT, - &&TARGET_COMPARE_OP_STR, &&TARGET_STORE_SUBSCR, &&TARGET_DELETE_SUBSCR, + &&TARGET_COMPARE_OP_INT, + &&TARGET_COMPARE_OP_STR, &&TARGET_FOR_ITER_LIST, &&TARGET_FOR_ITER_TUPLE, &&TARGET_FOR_ITER_RANGE, &&TARGET_FOR_ITER_GEN, - &&TARGET_LOAD_SUPER_ATTR_ATTR, - &&TARGET_LOAD_SUPER_ATTR_METHOD, &&TARGET_GET_ITER, &&TARGET_GET_YIELD_FROM_ITER, - &&TARGET_LOAD_ATTR_CLASS, + &&TARGET_LOAD_SUPER_ATTR_ATTR, &&TARGET_LOAD_BUILD_CLASS, - &&TARGET_LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN, - &&TARGET_LOAD_ATTR_INSTANCE_VALUE, + &&TARGET_LOAD_SUPER_ATTR_METHOD, + &&TARGET_LOAD_ATTR_CLASS, &&TARGET_LOAD_ASSERTION_ERROR, &&TARGET_RETURN_GENERATOR, + &&TARGET_LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN, + &&TARGET_LOAD_ATTR_INSTANCE_VALUE, &&TARGET_LOAD_ATTR_MODULE, &&TARGET_LOAD_ATTR_PROPERTY, &&TARGET_LOAD_ATTR_SLOT, &&TARGET_LOAD_ATTR_WITH_HINT, &&TARGET_LOAD_ATTR_METHOD_LAZY_DICT, - &&TARGET_LOAD_ATTR_METHOD_NO_DICT, - &&TARGET_LOAD_ATTR_METHOD_WITH_VALUES, &&TARGET_RETURN_VALUE, - &&TARGET_LOAD_CONST__LOAD_FAST, + &&TARGET_LOAD_ATTR_METHOD_NO_DICT, &&TARGET_SETUP_ANNOTATIONS, - &&TARGET_LOAD_FAST__LOAD_CONST, + &&TARGET_LOAD_ATTR_METHOD_WITH_VALUES, &&TARGET_LOAD_LOCALS, - &&TARGET_LOAD_GLOBAL_BUILTIN, + &&TARGET_LOAD_CONST__LOAD_FAST, &&TARGET_POP_EXCEPT, &&TARGET_STORE_NAME, &&TARGET_DELETE_NAME, @@ -110,9 +110,9 @@ static void *opcode_targets[256] = { &&TARGET_IMPORT_NAME, &&TARGET_IMPORT_FROM, &&TARGET_JUMP_FORWARD, + &&TARGET_LOAD_FAST__LOAD_CONST, + &&TARGET_LOAD_GLOBAL_BUILTIN, &&TARGET_LOAD_GLOBAL_MODULE, - &&TARGET_STORE_ATTR_INSTANCE_VALUE, - &&TARGET_STORE_ATTR_SLOT, &&TARGET_POP_JUMP_IF_FALSE, &&TARGET_POP_JUMP_IF_TRUE, &&TARGET_LOAD_GLOBAL, @@ -147,26 +147,26 @@ static void *opcode_targets[256] = { &&TARGET_LIST_APPEND, &&TARGET_SET_ADD, &&TARGET_MAP_ADD, - &&TARGET_STORE_ATTR_WITH_HINT, + &&TARGET_STORE_ATTR_INSTANCE_VALUE, &&TARGET_COPY_FREE_VARS, &&TARGET_YIELD_VALUE, &&TARGET_RESUME, &&TARGET_MATCH_CLASS, + &&TARGET_STORE_ATTR_SLOT, + &&TARGET_STORE_ATTR_WITH_HINT, &&TARGET_STORE_SUBSCR_DICT, - &&TARGET_STORE_SUBSCR_LIST_INT, - &&TARGET_FORMAT_VALUE, &&TARGET_BUILD_CONST_KEY_MAP, &&TARGET_BUILD_STRING, + &&TARGET_CONVERT_VALUE, + &&TARGET_STORE_SUBSCR_LIST_INT, &&TARGET_UNPACK_SEQUENCE_LIST, &&TARGET_UNPACK_SEQUENCE_TUPLE, - &&TARGET_UNPACK_SEQUENCE_TWO_TUPLE, - &&TARGET_SEND_GEN, &&TARGET_LIST_EXTEND, &&TARGET_SET_UPDATE, &&TARGET_DICT_MERGE, &&TARGET_DICT_UPDATE, - &&_unknown_opcode, - &&_unknown_opcode, + &&TARGET_UNPACK_SEQUENCE_TWO_TUPLE, + &&TARGET_SEND_GEN, &&TARGET_LOAD_FAST_LOAD_FAST, &&TARGET_STORE_FAST_LOAD_FAST, &&TARGET_STORE_FAST_STORE_FAST, From b6d71713a37f139ff06bf44981e189c6d0593c0f Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Mon, 5 Jun 2023 09:16:31 +0100 Subject: [PATCH 2/3] Fix up magic number. --- Lib/importlib/_bootstrap_external.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index 780e664f9ae181..293a83ce119a72 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -447,7 +447,8 @@ def _write_atomic(path, data, mode=0o666): # Python 3.12b1 3531 (Add PEP 695 changes) # Python 3.13a1 3550 (Plugin optimizer support) # Python 3.13a1 3551 (Compact superinstructions) -# Python 3.8a1 3553 (more efficient bytecodes for f-strings #33092) +# Python 3.13a1 3552 (Remove LOAD_FAST__LOAD_CONST and LOAD_CONST__LOAD_FAST) +# Python 3.13a1 3553 (more efficient bytecodes for f-strings) # Python 3.14 will start with 3600 From 62a340404047755e43e7dda44029a4eedfcb19cb Mon Sep 17 00:00:00 2001 From: Mark Shannon Date: Mon, 5 Jun 2023 12:13:32 +0100 Subject: [PATCH 3/3] Document new instructions. --- Doc/library/dis.rst | 53 +++++++++++++++++++++++++++++++-------------- 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 9b90f1ef23d92c..fcef9bd3c79c3b 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1423,26 +1423,47 @@ iterations of the loop. an argument from two-byte to four-byte. -.. opcode:: FORMAT_VALUE (flags) +.. opcode:: CONVERT_VALUE (oparg) - Used for implementing formatted literal strings (f-strings). Pops - an optional *fmt_spec* from the stack, then a required *value*. - *flags* is interpreted as follows: + Convert value to a string, depending on ``oparg``:: - * ``(flags & 0x03) == 0x00``: *value* is formatted as-is. - * ``(flags & 0x03) == 0x01``: call :func:`str` on *value* before - formatting it. - * ``(flags & 0x03) == 0x02``: call :func:`repr` on *value* before - formatting it. - * ``(flags & 0x03) == 0x03``: call :func:`ascii` on *value* before - formatting it. - * ``(flags & 0x04) == 0x04``: pop *fmt_spec* from the stack and use - it, else use an empty *fmt_spec*. + value = STACK.pop() + result = func(value) + STACK.push(result) - Formatting is performed using :c:func:`PyObject_Format`. The - result is pushed on the stack. + * ``oparg == 1``: call :func:`str` on *value* + * ``oparg == 2``: call :func:`repr` on *value* + * ``oparg == 3``: call :func:`ascii` on *value* - .. versionadded:: 3.6 + Used for implementing formatted literal strings (f-strings). + + .. versionadded:: 3.13 + + +.. opcode:: FORMAT_SIMPLE + + Formats the value on top of stack:: + + value = STACK.pop() + result = value.__format__("") + STACK.push(result) + + Used for implementing formatted literal strings (f-strings). + + .. versionadded:: 3.13 + +.. opcode:: FORMAT_SPEC + + Formats the given value with the given format spec:: + + spec = STACK.pop() + value = STACK.pop() + result = value.__format__(spec) + STACK.push(result) + + Used for implementing formatted literal strings (f-strings). + + .. versionadded:: 3.13 .. opcode:: MATCH_CLASS (count)