From 0a0ebe2a71eb46e07c8de7304fa2762768821751 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Mon, 10 Apr 2023 15:51:38 -0700 Subject: [PATCH 01/16] gh-87729: add instruction for faster zero-arg super() --- Include/internal/pycore_opcode.h | 13 +- Include/internal/pycore_typeobject.h | 3 + Include/opcode.h | 19 +- Lib/dis.py | 3 +- Lib/importlib/_bootstrap_external.py | 5 +- Lib/opcode.py | 3 +- Lib/test/shadowed_super.py | 7 + Lib/test/test_super.py | 51 +- Objects/typeobject.c | 68 ++- Python/bytecodes.c | 30 ++ Python/ceval.c | 1 + Python/compile.c | 85 ++- Python/generated_cases.c.h | 749 ++++++++++++++------------- Python/opcode_metadata.h | 5 + Python/opcode_targets.h | 8 +- 15 files changed, 652 insertions(+), 398 deletions(-) create mode 100644 Lib/test/shadowed_super.py diff --git a/Include/internal/pycore_opcode.h b/Include/internal/pycore_opcode.h index c039d712dc0ba1..39fe2ca62de1a6 100644 --- a/Include/internal/pycore_opcode.h +++ b/Include/internal/pycore_opcode.h @@ -179,6 +179,7 @@ const uint8_t _PyOpcode_Deopt[256] = { [LOAD_GLOBAL_BUILTIN] = LOAD_GLOBAL, [LOAD_GLOBAL_MODULE] = LOAD_GLOBAL, [LOAD_NAME] = LOAD_NAME, + [LOAD_ZERO_SUPER_ATTR] = LOAD_ZERO_SUPER_ATTR, [MAKE_CELL] = MAKE_CELL, [MAKE_FUNCTION] = MAKE_FUNCTION, [MAP_ADD] = MAP_ADD, @@ -236,7 +237,7 @@ const uint8_t _PyOpcode_Deopt[256] = { #endif // NEED_OPCODE_TABLES #ifdef Py_DEBUG -static const char *const _PyOpcode_OpName[263] = { +static const char *const _PyOpcode_OpName[264] = { [CACHE] = "CACHE", [POP_TOP] = "POP_TOP", [PUSH_NULL] = "PUSH_NULL", @@ -378,9 +379,9 @@ static const char *const _PyOpcode_OpName[263] = { [STORE_DEREF] = "STORE_DEREF", [DELETE_DEREF] = "DELETE_DEREF", [JUMP_BACKWARD] = "JUMP_BACKWARD", - [STORE_FAST__STORE_FAST] = "STORE_FAST__STORE_FAST", + [LOAD_ZERO_SUPER_ATTR] = "LOAD_ZERO_SUPER_ATTR", [CALL_FUNCTION_EX] = "CALL_FUNCTION_EX", - [STORE_SUBSCR_DICT] = "STORE_SUBSCR_DICT", + [STORE_FAST__STORE_FAST] = "STORE_FAST__STORE_FAST", [EXTENDED_ARG] = "EXTENDED_ARG", [LIST_APPEND] = "LIST_APPEND", [SET_ADD] = "SET_ADD", @@ -390,15 +391,15 @@ static const char *const _PyOpcode_OpName[263] = { [YIELD_VALUE] = "YIELD_VALUE", [RESUME] = "RESUME", [MATCH_CLASS] = "MATCH_CLASS", + [STORE_SUBSCR_DICT] = "STORE_SUBSCR_DICT", [STORE_SUBSCR_LIST_INT] = "STORE_SUBSCR_LIST_INT", - [UNPACK_SEQUENCE_LIST] = "UNPACK_SEQUENCE_LIST", [FORMAT_VALUE] = "FORMAT_VALUE", [BUILD_CONST_KEY_MAP] = "BUILD_CONST_KEY_MAP", [BUILD_STRING] = "BUILD_STRING", + [UNPACK_SEQUENCE_LIST] = "UNPACK_SEQUENCE_LIST", [UNPACK_SEQUENCE_TUPLE] = "UNPACK_SEQUENCE_TUPLE", [UNPACK_SEQUENCE_TWO_TUPLE] = "UNPACK_SEQUENCE_TWO_TUPLE", [SEND_GEN] = "SEND_GEN", - [161] = "<161>", [LIST_EXTEND] = "LIST_EXTEND", [SET_UPDATE] = "SET_UPDATE", [DICT_MERGE] = "DICT_MERGE", @@ -500,11 +501,11 @@ static const char *const _PyOpcode_OpName[263] = { [JUMP] = "JUMP", [JUMP_NO_INTERRUPT] = "JUMP_NO_INTERRUPT", [LOAD_METHOD] = "LOAD_METHOD", + [LOAD_ZERO_SUPER_METHOD] = "LOAD_ZERO_SUPER_METHOD", }; #endif #define EXTRA_CASES \ - case 161: \ case 166: \ case 167: \ case 168: \ diff --git a/Include/internal/pycore_typeobject.h b/Include/internal/pycore_typeobject.h index cc5ce2875101ea..324e500eaab8de 100644 --- a/Include/internal/pycore_typeobject.h +++ b/Include/internal/pycore_typeobject.h @@ -98,6 +98,9 @@ _Py_type_getattro(PyTypeObject *type, PyObject *name); PyObject *_Py_slot_tp_getattro(PyObject *self, PyObject *name); PyObject *_Py_slot_tp_getattr_hook(PyObject *self, PyObject *name); +PyObject * +_PySuper_Lookup(PyTypeObject *su_type, PyObject *su_obj, PyObject *name, int *meth_found); + #ifdef __cplusplus } #endif diff --git a/Include/opcode.h b/Include/opcode.h index aa8716ef5b4030..22e598ff5bf28f 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -95,6 +95,7 @@ extern "C" { #define STORE_DEREF 138 #define DELETE_DEREF 139 #define JUMP_BACKWARD 140 +#define LOAD_ZERO_SUPER_ATTR 141 #define CALL_FUNCTION_EX 142 #define EXTENDED_ARG 144 #define LIST_APPEND 145 @@ -142,7 +143,8 @@ extern "C" { #define JUMP 260 #define JUMP_NO_INTERRUPT 261 #define LOAD_METHOD 262 -#define MAX_PSEUDO_OPCODE 262 +#define LOAD_ZERO_SUPER_METHOD 263 +#define MAX_PSEUDO_OPCODE 263 #define BINARY_OP_ADD_FLOAT 6 #define BINARY_OP_ADD_INT 7 #define BINARY_OP_ADD_UNICODE 8 @@ -198,18 +200,19 @@ extern "C" { #define STORE_ATTR_SLOT 111 #define STORE_ATTR_WITH_HINT 112 #define STORE_FAST__LOAD_FAST 113 -#define STORE_FAST__STORE_FAST 141 -#define STORE_SUBSCR_DICT 143 -#define STORE_SUBSCR_LIST_INT 153 -#define UNPACK_SEQUENCE_LIST 154 -#define UNPACK_SEQUENCE_TUPLE 158 -#define UNPACK_SEQUENCE_TWO_TUPLE 159 -#define SEND_GEN 160 +#define STORE_FAST__STORE_FAST 143 +#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 HAS_ARG(op) ((((op) >= HAVE_ARGUMENT) && (!IS_PSEUDO_OPCODE(op)))\ || ((op) == JUMP) \ || ((op) == JUMP_NO_INTERRUPT) \ || ((op) == LOAD_METHOD) \ + || ((op) == LOAD_ZERO_SUPER_METHOD) \ ) #define HAS_CONST(op) (false\ diff --git a/Lib/dis.py b/Lib/dis.py index b39b2835330135..565c6bad8fe5ee 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -41,6 +41,7 @@ FOR_ITER = opmap['FOR_ITER'] SEND = opmap['SEND'] LOAD_ATTR = opmap['LOAD_ATTR'] +LOAD_ZERO_SUPER_ATTR = opmap['LOAD_ZERO_SUPER_ATTR'] CACHE = opmap["CACHE"] @@ -471,7 +472,7 @@ def _get_instructions_bytes(code, varname_from_oparg=None, argval, argrepr = _get_name_info(arg//2, get_name) if (arg & 1) and argrepr: argrepr = "NULL + " + argrepr - elif deop == LOAD_ATTR: + elif deop == LOAD_ATTR or deop == LOAD_ZERO_SUPER_ATTR: argval, argrepr = _get_name_info(arg//2, get_name) if (arg & 1) and argrepr: argrepr = "NULL|self + " + argrepr diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py index c0c757d94d8781..74a78bc9f6dc08 100644 --- a/Lib/importlib/_bootstrap_external.py +++ b/Lib/importlib/_bootstrap_external.py @@ -439,7 +439,8 @@ def _write_atomic(path, data, mode=0o666): # Python 3.12a7 3523 (Convert COMPARE_AND_BRANCH back to COMPARE_OP) # Python 3.12a7 3524 (Shrink the BINARY_SUBSCR caches) # Python 3.12b1 3525 (Shrink the CALL caches) -# Python 3.12a7 3526 (Add instrumentation support) +# Python 3.12b1 3526 (Add instrumentation support) +# Python 3.12b1 3527 (Optimize super() calls) # Python 3.13 will start with 3550 @@ -456,7 +457,7 @@ def _write_atomic(path, data, mode=0o666): # Whenever MAGIC_NUMBER is changed, the ranges in the magic_values array # in PC/launcher.c must also be updated. -MAGIC_NUMBER = (3526).to_bytes(2, 'little') + b'\r\n' +MAGIC_NUMBER = (3527).to_bytes(2, 'little') + b'\r\n' _RAW_MAGIC_NUMBER = int.from_bytes(MAGIC_NUMBER, 'little') # For import.c diff --git a/Lib/opcode.py b/Lib/opcode.py index dd739e5dd3f6f8..68c3ce80b52a67 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -196,7 +196,7 @@ def pseudo_op(name, op, real_ops): def_op('DELETE_DEREF', 139) hasfree.append(139) jrel_op('JUMP_BACKWARD', 140) # Number of words to skip (backwards) - +name_op('LOAD_ZERO_SUPER_ATTR', 141) def_op('CALL_FUNCTION_EX', 142) # Flags def_op('EXTENDED_ARG', 144) @@ -264,6 +264,7 @@ def pseudo_op(name, op, real_ops): pseudo_op('JUMP_NO_INTERRUPT', 261, ['JUMP_FORWARD', 'JUMP_BACKWARD_NO_INTERRUPT']) pseudo_op('LOAD_METHOD', 262, ['LOAD_ATTR']) +pseudo_op('LOAD_ZERO_SUPER_METHOD', 263, ['LOAD_ZERO_SUPER_ATTR']) MAX_PSEUDO_OPCODE = MIN_PSEUDO_OPCODE + len(_pseudo_ops) - 1 diff --git a/Lib/test/shadowed_super.py b/Lib/test/shadowed_super.py new file mode 100644 index 00000000000000..2a62f667e93818 --- /dev/null +++ b/Lib/test/shadowed_super.py @@ -0,0 +1,7 @@ +class super: + msg = "truly super" + + +class C: + def method(self): + return super().msg diff --git a/Lib/test/test_super.py b/Lib/test/test_super.py index a68b38cf79d537..e76abfde924b05 100644 --- a/Lib/test/test_super.py +++ b/Lib/test/test_super.py @@ -1,6 +1,8 @@ """Unit tests for zero-argument super() & related machinery.""" import unittest +from unittest.mock import patch +from test import shadowed_super class A: @@ -283,17 +285,28 @@ def f(self): def test_obscure_super_errors(self): def f(): super() - self.assertRaises(RuntimeError, f) + with self.assertRaisesRegex(RuntimeError, r"no arguments"): + f() + + class C: + def f(): + super() + with self.assertRaisesRegex(RuntimeError, r"no arguments"): + C.f() + def f(x): del x super() - self.assertRaises(RuntimeError, f, None) + with self.assertRaisesRegex(RuntimeError, r"arg\[0\] deleted"): + f(None) + class X: def f(x): nonlocal __class__ del __class__ super() - self.assertRaises(RuntimeError, X().f) + with self.assertRaisesRegex(RuntimeError, r"empty __class__ cell"): + X().f() def test_cell_as_self(self): class X: @@ -325,6 +338,38 @@ def test_super_argtype(self): with self.assertRaisesRegex(TypeError, "argument 1 must be a type"): super(1, int) + def test_shadowed_global(self): + self.assertEqual(shadowed_super.C().method(), "truly super") + + def test_shadowed_local(self): + class super: + msg = "quite super" + + class C: + def method(self): + return super().msg + + self.assertEqual(C().method(), "quite super") + + def test_shadowed_dynamic(self): + class MySuper: + msg = "super super" + + class C: + def method(self): + return super().msg + + with patch("test.test_super.super", MySuper) as m: + self.assertEqual(C().method(), "super super") + + def test_attribute_error(self): + class C: + def method(self): + return super().msg + + with self.assertRaisesRegex(AttributeError, "'super' object has no attribute 'msg'"): + C().method() + if __name__ == "__main__": unittest.main() diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 9ea458f30394e3..f6f30032d8291f 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -9358,14 +9358,15 @@ super_repr(PyObject *self) } static PyObject * -super_getattro(PyObject *self, PyObject *name) +do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj, + PyTypeObject *su_obj_type, PyObject *name, int *meth_found) { - superobject *su = (superobject *)self; PyTypeObject *starttype; - PyObject *mro; + PyObject *mro, *res; Py_ssize_t i, n; + int temp_su = 0; - starttype = su->obj_type; + starttype = su_obj_type; if (starttype == NULL) goto skip; @@ -9385,7 +9386,7 @@ super_getattro(PyObject *self, PyObject *name) /* No need to check the last one: it's gonna be skipped anyway. */ for (i = 0; i+1 < n; i++) { - if ((PyObject *)(su->type) == PyTuple_GET_ITEM(mro, i)) + if ((PyObject *)(su_type) == PyTuple_GET_ITEM(mro, i)) break; } i++; /* skip su->type (if any) */ @@ -9400,19 +9401,22 @@ super_getattro(PyObject *self, PyObject *name) PyObject *dict = _PyType_CAST(obj)->tp_dict; assert(dict != NULL && PyDict_Check(dict)); - PyObject *res = PyDict_GetItemWithError(dict, name); + res = PyDict_GetItemWithError(dict, name); if (res != NULL) { Py_INCREF(res); - - descrgetfunc f = Py_TYPE(res)->tp_descr_get; - if (f != NULL) { - PyObject *res2; - res2 = f(res, - /* Only pass 'obj' param if this is instance-mode super - (See SF ID #743627) */ - (su->obj == (PyObject *)starttype) ? NULL : su->obj, - (PyObject *)starttype); - Py_SETREF(res, res2); + if (meth_found && _PyType_HasFeature(Py_TYPE(res), Py_TPFLAGS_METHOD_DESCRIPTOR)) { + *meth_found = 1; + } else { + descrgetfunc f = Py_TYPE(res)->tp_descr_get; + if (f != NULL) { + PyObject *res2; + res2 = f(res, + /* Only pass 'obj' param if this is instance-mode super + (See SF ID #743627) */ + (su_obj == (PyObject *)starttype) ? NULL : su_obj, + (PyObject *)starttype); + Py_SETREF(res, res2); + } } Py_DECREF(mro); @@ -9428,7 +9432,25 @@ super_getattro(PyObject *self, PyObject *name) Py_DECREF(mro); skip: - return PyObject_GenericGetAttr(self, name); + if (su == NULL) { + su = PyObject_Vectorcall((PyObject *)&PySuper_Type, NULL, 0, NULL); + if (su == NULL) { + return NULL; + } + temp_su = 1; + } + res = PyObject_GenericGetAttr((PyObject *)su, name); + if (temp_su) { + Py_DECREF(su); + } + return res; +} + +static PyObject * +super_getattro(PyObject *self, PyObject *name) +{ + superobject *su = (superobject *)self; + return do_super_lookup(su, su->type, su->obj, su->obj_type, name, NULL); } static PyTypeObject * @@ -9484,6 +9506,18 @@ supercheck(PyTypeObject *type, PyObject *obj) return NULL; } +PyObject * +_PySuper_Lookup(PyTypeObject *su_type, PyObject *su_obj, PyObject *name, int *meth_found) +{ + PyTypeObject *su_obj_type = supercheck(su_type, su_obj); + if (su_obj_type == NULL) { + return NULL; + } + PyObject *res = do_super_lookup(NULL, su_type, su_obj, su_obj_type, name, meth_found); + Py_DECREF(su_obj_type); + return res; +} + static PyObject * super_descr_get(PyObject *self, PyObject *obj, PyObject *type) { diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 5c6398aba198f9..f6b56158faf1fb 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -25,6 +25,7 @@ #include "pycore_sliceobject.h" // _PyBuildSlice_ConsumeRefs #include "pycore_sysmodule.h" // _PySys_Audit() #include "pycore_tuple.h" // _PyTuple_ITEMS() +#include "pycore_typeobject.h" // _PySuper_Lookup() #include "pycore_emscripten_signal.h" // _Py_CHECK_EMSCRIPTEN_SIGNALS #include "pycore_dict.h" @@ -1550,6 +1551,35 @@ dummy_func( PREDICT(JUMP_BACKWARD); } + inst(LOAD_ZERO_SUPER_ATTR, (global_super, class, self -- res2 if (oparg & 1), res)) { + PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 1); + if (global_super == (PyObject *)&PySuper_Type) { + int meth_found = 0; + Py_DECREF(global_super); + assert(PyType_Check(class)); + res = _PySuper_Lookup((PyTypeObject *)class, self, name, oparg & 1 ? &meth_found : NULL); + Py_DECREF(class); + if (res == NULL) { + Py_DECREF(self); + ERROR_IF(true, error); + } + if (meth_found) { + res2 = res; + res = self; // transfer ownership + } else { + res2 = NULL; + Py_DECREF(self); + } + } else { + PyObject *super = PyObject_Vectorcall(global_super, NULL, 0, NULL); + DECREF_INPUTS(); + ERROR_IF(super == NULL, error); + res = PyObject_GetAttr(super, name); + Py_DECREF(super); + ERROR_IF(res == NULL, error); + } + } + family(load_attr, INLINE_CACHE_ENTRIES_LOAD_ATTR) = { LOAD_ATTR, LOAD_ATTR_INSTANCE_VALUE, diff --git a/Python/ceval.c b/Python/ceval.c index a38c9ec9ad5f9c..53c71078d1692d 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -21,6 +21,7 @@ #include "pycore_sliceobject.h" // _PyBuildSlice_ConsumeRefs #include "pycore_sysmodule.h" // _PySys_Audit() #include "pycore_tuple.h" // _PyTuple_ITEMS() +#include "pycore_typeobject.h" // _PySuper_Lookup() #include "pycore_emscripten_signal.h" // _Py_CHECK_EMSCRIPTEN_SIGNALS #include "pycore_dict.h" diff --git a/Python/compile.c b/Python/compile.c index d6882c31d6437e..cffc124dbd1556 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -829,6 +829,8 @@ stack_effect(int opcode, int oparg, int jump) case LOAD_METHOD: return 1; + case LOAD_ZERO_SUPER_METHOD: + return -1; default: return PY_INVALID_STACK_EFFECT; } @@ -1039,7 +1041,7 @@ compiler_addop_name(struct compiler_unit *u, location loc, if (arg < 0) { return ERROR; } - if (opcode == LOAD_ATTR) { + if (opcode == LOAD_ATTR || opcode == LOAD_ZERO_SUPER_ATTR) { arg <<= 1; } if (opcode == LOAD_METHOD) { @@ -1047,6 +1049,11 @@ compiler_addop_name(struct compiler_unit *u, location loc, arg <<= 1; arg |= 1; } + if (opcode == LOAD_ZERO_SUPER_METHOD) { + opcode = LOAD_ZERO_SUPER_ATTR; + arg <<= 1; + arg |= 1; + } return codegen_addop_i(&u->u_instr_sequence, opcode, arg, loc); } @@ -4214,6 +4221,63 @@ is_import_originated(struct compiler *c, expr_ty e) return flags & DEF_IMPORT; } +static int +is_zero_arg_super_call(struct compiler *c, expr_ty e) +{ + if (e->kind != Call_kind || + e->v.Call.func->kind != Name_kind || + !_PyUnicode_EqualToASCIIString(e->v.Call.func->v.Name.id, "super") || + asdl_seq_LEN(e->v.Call.args) != 0 || + asdl_seq_LEN(e->v.Call.keywords) != 0) { + return 0; + } + + PyObject *super_name = e->v.Call.func->v.Name.id; + // try to detect statically-visible shadowing of 'super' name + int scope = _PyST_GetScope(c->u->u_ste, super_name); + if (scope != GLOBAL_IMPLICIT) { + return 0; + } + scope = _PyST_GetScope(c->c_st->st_top, super_name); + if (scope != 0) { + return 0; + } + // enclosing function should have at least one argument + if (c->u->u_metadata.u_argcount == 0 && + c->u->u_metadata.u_posonlyargcount == 0) { + return 0; + } + // __class__ cell should be available + if (get_ref_type(c, &_Py_ID(__class__)) == FREE) { + return 1; + } + return 0; +} + +static int +load_args_for_zero_super(struct compiler *c, expr_ty e) { + location loc = LOC(e); + + // load super() global + PyObject *super_name = e->v.Attribute.value->v.Call.func->v.Name.id; + RETURN_IF_ERROR(compiler_nameop(c, loc, super_name, Load)); + + // load __class__ cell + PyObject *name = &_Py_ID(__class__); + assert(get_ref_type(c, name) == FREE); + RETURN_IF_ERROR(compiler_nameop(c, loc, name, Load)); + + // load self (first argument) + Py_ssize_t i = 0; + PyObject *key, *value; + if (!PyDict_Next(c->u->u_metadata.u_varnames, &i, &key, &value)) { + return ERROR; + } + RETURN_IF_ERROR(compiler_nameop(c, loc, key, Load)); + + return SUCCESS; +} + // If an attribute access spans multiple lines, update the current start // location to point to the attribute name. static location @@ -4281,11 +4345,19 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e) return 0; } } + /* Alright, we can optimize the code. */ - VISIT(c, expr, meth->v.Attribute.value); location loc = LOC(meth); - loc = update_start_location_to_match_attr(c, loc, meth); - ADDOP_NAME(c, loc, LOAD_METHOD, meth->v.Attribute.attr, names); + + if (is_zero_arg_super_call(c, meth->v.Attribute.value)) { + RETURN_IF_ERROR(load_args_for_zero_super(c, meth)); + ADDOP_NAME(c, loc, LOAD_ZERO_SUPER_METHOD, meth->v.Attribute.attr, names); + } else { + VISIT(c, expr, meth->v.Attribute.value); + loc = update_start_location_to_match_attr(c, loc, meth); + ADDOP_NAME(c, loc, LOAD_METHOD, meth->v.Attribute.attr, names); + } + VISIT_SEQ(c, expr, e->v.Call.args); if (kwdsl) { @@ -5293,6 +5365,11 @@ compiler_visit_expr1(struct compiler *c, expr_ty e) return compiler_formatted_value(c, e); /* The following exprs can be assignment targets. */ case Attribute_kind: + if (e->v.Attribute.ctx == Load && is_zero_arg_super_call(c, e->v.Attribute.value)) { + RETURN_IF_ERROR(load_args_for_zero_super(c, e)); + ADDOP_NAME(c, loc, LOAD_ZERO_SUPER_ATTR, e->v.Attribute.attr, names); + return SUCCESS; + } VISIT(c, expr, e->v.Attribute.value); loc = LOC(e); loc = update_start_location_to_match_attr(c, loc, e); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 4d52e95dc04a27..434605903be99c 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -8,7 +8,7 @@ } TARGET(RESUME) { - #line 136 "Python/bytecodes.c" + #line 137 "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 150 "Python/bytecodes.c" + #line 151 "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 178 "Python/bytecodes.c" + #line 179 "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 185 "Python/bytecodes.c" + #line 186 "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 191 "Python/bytecodes.c" + #line 192 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); @@ -95,7 +95,7 @@ TARGET(LOAD_CONST) { PREDICTED(LOAD_CONST); PyObject *value; - #line 197 "Python/bytecodes.c" + #line 198 "Python/bytecodes.c" value = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(value); #line 102 "Python/generated_cases.c.h" @@ -106,7 +106,7 @@ TARGET(STORE_FAST) { PyObject *value = stack_pointer[-1]; - #line 202 "Python/bytecodes.c" + #line 203 "Python/bytecodes.c" SETLOCAL(oparg, value); #line 112 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -118,7 +118,7 @@ PyObject *_tmp_2; { PyObject *value; - #line 191 "Python/bytecodes.c" + #line 192 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); @@ -128,7 +128,7 @@ oparg = (next_instr++)->op.arg; { PyObject *value; - #line 191 "Python/bytecodes.c" + #line 192 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); @@ -146,7 +146,7 @@ PyObject *_tmp_2; { PyObject *value; - #line 191 "Python/bytecodes.c" + #line 192 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); @@ -156,7 +156,7 @@ oparg = (next_instr++)->op.arg; { PyObject *value; - #line 197 "Python/bytecodes.c" + #line 198 "Python/bytecodes.c" value = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(value); #line 163 "Python/generated_cases.c.h" @@ -172,14 +172,14 @@ PyObject *_tmp_1 = stack_pointer[-1]; { PyObject *value = _tmp_1; - #line 202 "Python/bytecodes.c" + #line 203 "Python/bytecodes.c" SETLOCAL(oparg, value); #line 178 "Python/generated_cases.c.h" } oparg = (next_instr++)->op.arg; { PyObject *value; - #line 191 "Python/bytecodes.c" + #line 192 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); @@ -195,14 +195,14 @@ PyObject *_tmp_2 = stack_pointer[-2]; { PyObject *value = _tmp_1; - #line 202 "Python/bytecodes.c" + #line 203 "Python/bytecodes.c" SETLOCAL(oparg, value); #line 201 "Python/generated_cases.c.h" } oparg = (next_instr++)->op.arg; { PyObject *value = _tmp_2; - #line 202 "Python/bytecodes.c" + #line 203 "Python/bytecodes.c" SETLOCAL(oparg, value); #line 208 "Python/generated_cases.c.h" } @@ -215,7 +215,7 @@ PyObject *_tmp_2; { PyObject *value; - #line 197 "Python/bytecodes.c" + #line 198 "Python/bytecodes.c" value = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(value); #line 222 "Python/generated_cases.c.h" @@ -224,7 +224,7 @@ oparg = (next_instr++)->op.arg; { PyObject *value; - #line 191 "Python/bytecodes.c" + #line 192 "Python/bytecodes.c" value = GETLOCAL(oparg); assert(value != NULL); Py_INCREF(value); @@ -239,7 +239,7 @@ TARGET(POP_TOP) { PyObject *value = stack_pointer[-1]; - #line 212 "Python/bytecodes.c" + #line 213 "Python/bytecodes.c" #line 244 "Python/generated_cases.c.h" Py_DECREF(value); STACK_SHRINK(1); @@ -248,7 +248,7 @@ TARGET(PUSH_NULL) { PyObject *res; - #line 216 "Python/bytecodes.c" + #line 217 "Python/bytecodes.c" res = NULL; #line 254 "Python/generated_cases.c.h" STACK_GROW(1); @@ -261,13 +261,13 @@ PyObject *_tmp_2 = stack_pointer[-2]; { PyObject *value = _tmp_1; - #line 212 "Python/bytecodes.c" + #line 213 "Python/bytecodes.c" #line 266 "Python/generated_cases.c.h" Py_DECREF(value); } { PyObject *value = _tmp_2; - #line 212 "Python/bytecodes.c" + #line 213 "Python/bytecodes.c" #line 272 "Python/generated_cases.c.h" Py_DECREF(value); } @@ -278,7 +278,7 @@ TARGET(INSTRUMENTED_END_FOR) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 222 "Python/bytecodes.c" + #line 223 "Python/bytecodes.c" /* Need to create a fake StopIteration error here, * to conform to PEP 380 */ if (PyGen_Check(receiver)) { @@ -298,7 +298,7 @@ TARGET(END_SEND) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 235 "Python/bytecodes.c" + #line 236 "Python/bytecodes.c" Py_DECREF(receiver); #line 304 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -309,7 +309,7 @@ TARGET(INSTRUMENTED_END_SEND) { PyObject *value = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 239 "Python/bytecodes.c" + #line 240 "Python/bytecodes.c" if (PyGen_Check(receiver) || PyCoro_CheckExact(receiver)) { PyErr_SetObject(PyExc_StopIteration, value); if (monitor_stop_iteration(tstate, frame, next_instr-1)) { @@ -327,11 +327,11 @@ TARGET(UNARY_NEGATIVE) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 250 "Python/bytecodes.c" + #line 251 "Python/bytecodes.c" res = PyNumber_Negative(value); #line 333 "Python/generated_cases.c.h" Py_DECREF(value); - #line 252 "Python/bytecodes.c" + #line 253 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; #line 337 "Python/generated_cases.c.h" stack_pointer[-1] = res; @@ -341,11 +341,11 @@ TARGET(UNARY_NOT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 256 "Python/bytecodes.c" + #line 257 "Python/bytecodes.c" int err = PyObject_IsTrue(value); #line 347 "Python/generated_cases.c.h" Py_DECREF(value); - #line 258 "Python/bytecodes.c" + #line 259 "Python/bytecodes.c" if (err < 0) goto pop_1_error; if (err == 0) { res = Py_True; @@ -362,11 +362,11 @@ TARGET(UNARY_INVERT) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 269 "Python/bytecodes.c" + #line 270 "Python/bytecodes.c" res = PyNumber_Invert(value); #line 368 "Python/generated_cases.c.h" Py_DECREF(value); - #line 271 "Python/bytecodes.c" + #line 272 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; #line 372 "Python/generated_cases.c.h" stack_pointer[-1] = res; @@ -377,7 +377,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *prod; - #line 288 "Python/bytecodes.c" + #line 289 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -396,7 +396,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *prod; - #line 298 "Python/bytecodes.c" + #line 299 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -414,7 +414,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *sub; - #line 307 "Python/bytecodes.c" + #line 308 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(!PyLong_CheckExact(right), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -433,7 +433,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *sub; - #line 317 "Python/bytecodes.c" + #line 318 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(!PyFloat_CheckExact(right), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -450,7 +450,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 325 "Python/bytecodes.c" + #line 326 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -468,7 +468,7 @@ TARGET(BINARY_OP_INPLACE_ADD_UNICODE) { PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; - #line 341 "Python/bytecodes.c" + #line 342 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), BINARY_OP); DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP); _Py_CODEUNIT true_next = next_instr[INLINE_CACHE_ENTRIES_BINARY_OP]; @@ -504,7 +504,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *sum; - #line 370 "Python/bytecodes.c" + #line 371 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), BINARY_OP); DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -522,7 +522,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *sum; - #line 379 "Python/bytecodes.c" + #line 380 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(left), BINARY_OP); DEOPT_IF(Py_TYPE(right) != Py_TYPE(left), BINARY_OP); STAT_INC(BINARY_OP, hit); @@ -543,7 +543,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; PyObject *res; - #line 397 "Python/bytecodes.c" + #line 398 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinarySubscrCache *cache = (_PyBinarySubscrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -558,7 +558,7 @@ #line 559 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 409 "Python/bytecodes.c" + #line 410 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; #line 564 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -572,7 +572,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *res; - #line 413 "Python/bytecodes.c" + #line 414 "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. @@ -596,7 +596,7 @@ PyObject *start = stack_pointer[-2]; PyObject *container = stack_pointer[-3]; PyObject *v = stack_pointer[-4]; - #line 428 "Python/bytecodes.c" + #line 429 "Python/bytecodes.c" PyObject *slice = _PyBuildSlice_ConsumeRefs(start, stop); int err; if (slice == NULL) { @@ -618,7 +618,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *res; - #line 443 "Python/bytecodes.c" + #line 444 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), BINARY_SUBSCR); @@ -643,7 +643,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *tuple = stack_pointer[-2]; PyObject *res; - #line 459 "Python/bytecodes.c" + #line 460 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), BINARY_SUBSCR); DEOPT_IF(!PyTuple_CheckExact(tuple), BINARY_SUBSCR); @@ -668,7 +668,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *res; - #line 475 "Python/bytecodes.c" + #line 476 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), BINARY_SUBSCR); STAT_INC(BINARY_SUBSCR, hit); res = PyDict_GetItemWithError(dict, sub); @@ -679,7 +679,7 @@ #line 680 "Python/generated_cases.c.h" Py_DECREF(dict); Py_DECREF(sub); - #line 483 "Python/bytecodes.c" + #line 484 "Python/bytecodes.c" if (true) goto pop_2_error; } Py_INCREF(res); // Do this before DECREF'ing dict, sub @@ -695,7 +695,7 @@ TARGET(BINARY_SUBSCR_GETITEM) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 490 "Python/bytecodes.c" + #line 491 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(container); DEOPT_IF(!PyType_HasFeature(tp, Py_TPFLAGS_HEAPTYPE), BINARY_SUBSCR); PyHeapTypeObject *ht = (PyHeapTypeObject *)tp; @@ -722,7 +722,7 @@ TARGET(LIST_APPEND) { PyObject *v = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 513 "Python/bytecodes.c" + #line 514 "Python/bytecodes.c" if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error; #line 728 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -733,11 +733,11 @@ TARGET(SET_ADD) { PyObject *v = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 518 "Python/bytecodes.c" + #line 519 "Python/bytecodes.c" int err = PySet_Add(set, v); #line 739 "Python/generated_cases.c.h" Py_DECREF(v); - #line 520 "Python/bytecodes.c" + #line 521 "Python/bytecodes.c" if (err) goto pop_1_error; #line 743 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -752,7 +752,7 @@ PyObject *container = stack_pointer[-2]; PyObject *v = stack_pointer[-3]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 531 "Python/bytecodes.c" + #line 532 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { next_instr--; @@ -771,7 +771,7 @@ Py_DECREF(v); Py_DECREF(container); Py_DECREF(sub); - #line 546 "Python/bytecodes.c" + #line 547 "Python/bytecodes.c" if (err) goto pop_3_error; #line 777 "Python/generated_cases.c.h" STACK_SHRINK(3); @@ -783,7 +783,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *list = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 550 "Python/bytecodes.c" + #line 551 "Python/bytecodes.c" DEOPT_IF(!PyLong_CheckExact(sub), STORE_SUBSCR); DEOPT_IF(!PyList_CheckExact(list), STORE_SUBSCR); @@ -810,7 +810,7 @@ PyObject *sub = stack_pointer[-1]; PyObject *dict = stack_pointer[-2]; PyObject *value = stack_pointer[-3]; - #line 569 "Python/bytecodes.c" + #line 570 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(dict), STORE_SUBSCR); STAT_INC(STORE_SUBSCR, hit); int err = _PyDict_SetItem_Take2((PyDictObject *)dict, sub, value); @@ -825,13 +825,13 @@ TARGET(DELETE_SUBSCR) { PyObject *sub = stack_pointer[-1]; PyObject *container = stack_pointer[-2]; - #line 577 "Python/bytecodes.c" + #line 578 "Python/bytecodes.c" /* del container[sub] */ int err = PyObject_DelItem(container, sub); #line 832 "Python/generated_cases.c.h" Py_DECREF(container); Py_DECREF(sub); - #line 580 "Python/bytecodes.c" + #line 581 "Python/bytecodes.c" if (err) goto pop_2_error; #line 837 "Python/generated_cases.c.h" STACK_SHRINK(2); @@ -841,12 +841,12 @@ TARGET(CALL_INTRINSIC_1) { PyObject *value = stack_pointer[-1]; PyObject *res; - #line 584 "Python/bytecodes.c" + #line 585 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_1); res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value); #line 848 "Python/generated_cases.c.h" Py_DECREF(value); - #line 587 "Python/bytecodes.c" + #line 588 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; #line 852 "Python/generated_cases.c.h" stack_pointer[-1] = res; @@ -857,13 +857,13 @@ PyObject *value1 = stack_pointer[-1]; PyObject *value2 = stack_pointer[-2]; PyObject *res; - #line 591 "Python/bytecodes.c" + #line 592 "Python/bytecodes.c" assert(oparg <= MAX_INTRINSIC_2); res = _PyIntrinsics_BinaryFunctions[oparg](tstate, value2, value1); #line 864 "Python/generated_cases.c.h" Py_DECREF(value2); Py_DECREF(value1); - #line 594 "Python/bytecodes.c" + #line 595 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; #line 869 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -873,7 +873,7 @@ TARGET(RAISE_VARARGS) { PyObject **args = (stack_pointer - oparg); - #line 598 "Python/bytecodes.c" + #line 599 "Python/bytecodes.c" PyObject *cause = NULL, *exc = NULL; switch (oparg) { case 2: @@ -896,7 +896,7 @@ TARGET(INTERPRETER_EXIT) { PyObject *retval = stack_pointer[-1]; - #line 618 "Python/bytecodes.c" + #line 619 "Python/bytecodes.c" assert(frame == &entry_frame); assert(_PyFrame_IsIncomplete(frame)); STACK_SHRINK(1); // Since we're not going to DISPATCH() @@ -912,7 +912,7 @@ TARGET(RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 631 "Python/bytecodes.c" + #line 632 "Python/bytecodes.c" STACK_SHRINK(1); assert(EMPTY()); _PyFrame_SetStackPointer(frame, stack_pointer); @@ -929,7 +929,7 @@ TARGET(INSTRUMENTED_RETURN_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 645 "Python/bytecodes.c" + #line 646 "Python/bytecodes.c" int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, frame, next_instr-1, retval); @@ -949,7 +949,7 @@ } TARGET(RETURN_CONST) { - #line 663 "Python/bytecodes.c" + #line 664 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); Py_INCREF(retval); assert(EMPTY()); @@ -966,7 +966,7 @@ } TARGET(INSTRUMENTED_RETURN_CONST) { - #line 678 "Python/bytecodes.c" + #line 679 "Python/bytecodes.c" PyObject *retval = GETITEM(frame->f_code->co_consts, oparg); int err = _Py_call_instrumentation_arg( tstate, PY_MONITORING_EVENT_PY_RETURN, @@ -989,7 +989,7 @@ TARGET(GET_AITER) { PyObject *obj = stack_pointer[-1]; PyObject *iter; - #line 697 "Python/bytecodes.c" + #line 698 "Python/bytecodes.c" unaryfunc getter = NULL; PyTypeObject *type = Py_TYPE(obj); @@ -1004,14 +1004,14 @@ type->tp_name); #line 1006 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 710 "Python/bytecodes.c" + #line 711 "Python/bytecodes.c" if (true) goto pop_1_error; } iter = (*getter)(obj); #line 1013 "Python/generated_cases.c.h" Py_DECREF(obj); - #line 715 "Python/bytecodes.c" + #line 716 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; if (Py_TYPE(iter)->tp_as_async == NULL || @@ -1032,7 +1032,7 @@ TARGET(GET_ANEXT) { PyObject *aiter = stack_pointer[-1]; PyObject *awaitable; - #line 730 "Python/bytecodes.c" + #line 731 "Python/bytecodes.c" unaryfunc getter = NULL; PyObject *next_iter = NULL; PyTypeObject *type = Py_TYPE(aiter); @@ -1087,7 +1087,7 @@ PREDICTED(GET_AWAITABLE); PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 777 "Python/bytecodes.c" + #line 778 "Python/bytecodes.c" iter = _PyCoro_GetAwaitableIter(iterable); if (iter == NULL) { @@ -1096,7 +1096,7 @@ #line 1098 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 784 "Python/bytecodes.c" + #line 785 "Python/bytecodes.c" if (iter != NULL && PyCoro_CheckExact(iter)) { PyObject *yf = _PyGen_yf((PyGenObject*)iter); @@ -1125,7 +1125,7 @@ PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; PyObject *retval; - #line 810 "Python/bytecodes.c" + #line 811 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PySendCache *cache = (_PySendCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1180,7 +1180,7 @@ TARGET(SEND_GEN) { PyObject *v = stack_pointer[-1]; PyObject *receiver = stack_pointer[-2]; - #line 858 "Python/bytecodes.c" + #line 859 "Python/bytecodes.c" PyGenObject *gen = (PyGenObject *)receiver; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type && Py_TYPE(gen) != &PyCoro_Type, SEND); @@ -1200,7 +1200,7 @@ TARGET(INSTRUMENTED_YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 875 "Python/bytecodes.c" + #line 876 "Python/bytecodes.c" assert(frame != &entry_frame); PyGenObject *gen = _PyFrame_GetGenerator(frame); gen->gi_frame_state = FRAME_SUSPENDED; @@ -1223,7 +1223,7 @@ TARGET(YIELD_VALUE) { PyObject *retval = stack_pointer[-1]; - #line 895 "Python/bytecodes.c" + #line 896 "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. @@ -1245,7 +1245,7 @@ TARGET(POP_EXCEPT) { PyObject *exc_value = stack_pointer[-1]; - #line 914 "Python/bytecodes.c" + #line 915 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; Py_XSETREF(exc_info->exc_value, exc_value); #line 1252 "Python/generated_cases.c.h" @@ -1256,7 +1256,7 @@ TARGET(RERAISE) { PyObject *exc = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); - #line 919 "Python/bytecodes.c" + #line 920 "Python/bytecodes.c" assert(oparg >= 0 && oparg <= 2); if (oparg) { PyObject *lasti = values[0]; @@ -1280,13 +1280,13 @@ TARGET(END_ASYNC_FOR) { PyObject *exc = stack_pointer[-1]; PyObject *awaitable = stack_pointer[-2]; - #line 939 "Python/bytecodes.c" + #line 940 "Python/bytecodes.c" assert(exc && PyExceptionInstance_Check(exc)); if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) { #line 1287 "Python/generated_cases.c.h" Py_DECREF(awaitable); Py_DECREF(exc); - #line 942 "Python/bytecodes.c" + #line 943 "Python/bytecodes.c" } else { Py_INCREF(exc); @@ -1304,7 +1304,7 @@ PyObject *sub_iter = stack_pointer[-3]; PyObject *none; PyObject *value; - #line 951 "Python/bytecodes.c" + #line 952 "Python/bytecodes.c" assert(throwflag); assert(exc_value && PyExceptionInstance_Check(exc_value)); if (PyErr_GivenExceptionMatches(exc_value, PyExc_StopIteration)) { @@ -1313,7 +1313,7 @@ Py_DECREF(sub_iter); Py_DECREF(last_sent_val); Py_DECREF(exc_value); - #line 956 "Python/bytecodes.c" + #line 957 "Python/bytecodes.c" none = Py_NewRef(Py_None); } else { @@ -1329,7 +1329,7 @@ TARGET(LOAD_ASSERTION_ERROR) { PyObject *value; - #line 965 "Python/bytecodes.c" + #line 966 "Python/bytecodes.c" value = Py_NewRef(PyExc_AssertionError); #line 1335 "Python/generated_cases.c.h" STACK_GROW(1); @@ -1339,7 +1339,7 @@ TARGET(LOAD_BUILD_CLASS) { PyObject *bc; - #line 969 "Python/bytecodes.c" + #line 970 "Python/bytecodes.c" if (PyDict_CheckExact(BUILTINS())) { bc = _PyDict_GetItemWithError(BUILTINS(), &_Py_ID(__build_class__)); @@ -1369,7 +1369,7 @@ TARGET(STORE_NAME) { PyObject *v = stack_pointer[-1]; - #line 993 "Python/bytecodes.c" + #line 994 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; @@ -1378,7 +1378,7 @@ "no locals found when storing %R", name); #line 1380 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1000 "Python/bytecodes.c" + #line 1001 "Python/bytecodes.c" if (true) goto pop_1_error; } if (PyDict_CheckExact(ns)) @@ -1387,7 +1387,7 @@ err = PyObject_SetItem(ns, name, v); #line 1389 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1007 "Python/bytecodes.c" + #line 1008 "Python/bytecodes.c" if (err) goto pop_1_error; #line 1393 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -1395,7 +1395,7 @@ } TARGET(DELETE_NAME) { - #line 1011 "Python/bytecodes.c" + #line 1012 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *ns = LOCALS(); int err; @@ -1420,7 +1420,7 @@ PREDICTED(UNPACK_SEQUENCE); static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size"); PyObject *seq = stack_pointer[-1]; - #line 1037 "Python/bytecodes.c" + #line 1038 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1435,7 +1435,7 @@ int res = unpack_iterable(tstate, seq, oparg, -1, top); #line 1437 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1050 "Python/bytecodes.c" + #line 1051 "Python/bytecodes.c" if (res == 0) goto pop_1_error; #line 1441 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -1447,7 +1447,7 @@ TARGET(UNPACK_SEQUENCE_TWO_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1054 "Python/bytecodes.c" + #line 1055 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != 2, UNPACK_SEQUENCE); assert(oparg == 2); @@ -1465,7 +1465,7 @@ TARGET(UNPACK_SEQUENCE_TUPLE) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1064 "Python/bytecodes.c" + #line 1065 "Python/bytecodes.c" DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1484,7 +1484,7 @@ TARGET(UNPACK_SEQUENCE_LIST) { PyObject *seq = stack_pointer[-1]; PyObject **values = stack_pointer - (1); - #line 1075 "Python/bytecodes.c" + #line 1076 "Python/bytecodes.c" DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE); DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE); STAT_INC(UNPACK_SEQUENCE, hit); @@ -1502,13 +1502,13 @@ TARGET(UNPACK_EX) { PyObject *seq = stack_pointer[-1]; - #line 1086 "Python/bytecodes.c" + #line 1087 "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 1510 "Python/generated_cases.c.h" Py_DECREF(seq); - #line 1090 "Python/bytecodes.c" + #line 1091 "Python/bytecodes.c" if (res == 0) goto pop_1_error; #line 1514 "Python/generated_cases.c.h" STACK_GROW((oparg & 0xFF) + (oparg >> 8)); @@ -1521,7 +1521,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *v = stack_pointer[-2]; uint16_t counter = read_u16(&next_instr[0].cache); - #line 1101 "Python/bytecodes.c" + #line 1102 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION if (ADAPTIVE_COUNTER_IS_ZERO(counter)) { PyObject *name = GETITEM(frame->f_code->co_names, oparg); @@ -1540,7 +1540,7 @@ #line 1541 "Python/generated_cases.c.h" Py_DECREF(v); Py_DECREF(owner); - #line 1117 "Python/bytecodes.c" + #line 1118 "Python/bytecodes.c" if (err) goto pop_2_error; #line 1546 "Python/generated_cases.c.h" STACK_SHRINK(2); @@ -1550,12 +1550,12 @@ TARGET(DELETE_ATTR) { PyObject *owner = stack_pointer[-1]; - #line 1121 "Python/bytecodes.c" + #line 1122 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyObject_SetAttr(owner, name, (PyObject *)NULL); #line 1557 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1124 "Python/bytecodes.c" + #line 1125 "Python/bytecodes.c" if (err) goto pop_1_error; #line 1561 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -1564,12 +1564,12 @@ TARGET(STORE_GLOBAL) { PyObject *v = stack_pointer[-1]; - #line 1128 "Python/bytecodes.c" + #line 1129 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err = PyDict_SetItem(GLOBALS(), name, v); #line 1571 "Python/generated_cases.c.h" Py_DECREF(v); - #line 1131 "Python/bytecodes.c" + #line 1132 "Python/bytecodes.c" if (err) goto pop_1_error; #line 1575 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -1577,7 +1577,7 @@ } TARGET(DELETE_GLOBAL) { - #line 1135 "Python/bytecodes.c" + #line 1136 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); int err; err = PyDict_DelItem(GLOBALS(), name); @@ -1595,7 +1595,7 @@ TARGET(LOAD_NAME) { PyObject *v; - #line 1149 "Python/bytecodes.c" + #line 1150 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); PyObject *locals = LOCALS(); if (locals == NULL) { @@ -1665,7 +1665,7 @@ static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size"); PyObject *null = NULL; PyObject *v; - #line 1216 "Python/bytecodes.c" + #line 1217 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -1731,7 +1731,7 @@ PyObject *res; uint16_t index = read_u16(&next_instr[1].cache); uint16_t version = read_u16(&next_instr[2].cache); - #line 1270 "Python/bytecodes.c" + #line 1271 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); PyDictObject *dict = (PyDictObject *)GLOBALS(); DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL); @@ -1757,7 +1757,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 1283 "Python/bytecodes.c" + #line 1284 "Python/bytecodes.c" DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL); DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL); PyDictObject *mdict = (PyDictObject *)GLOBALS(); @@ -1782,7 +1782,7 @@ } TARGET(DELETE_FAST) { - #line 1300 "Python/bytecodes.c" + #line 1301 "Python/bytecodes.c" PyObject *v = GETLOCAL(oparg); if (v == NULL) goto unbound_local_error; SETLOCAL(oparg, NULL); @@ -1791,7 +1791,7 @@ } TARGET(MAKE_CELL) { - #line 1306 "Python/bytecodes.c" + #line 1307 "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); @@ -1805,7 +1805,7 @@ } TARGET(DELETE_DEREF) { - #line 1317 "Python/bytecodes.c" + #line 1318 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); // Can't use ERROR_IF here. @@ -1822,7 +1822,7 @@ TARGET(LOAD_CLASSDEREF) { PyObject *value; - #line 1330 "Python/bytecodes.c" + #line 1331 "Python/bytecodes.c" PyObject *name, *locals = LOCALS(); assert(locals); assert(oparg >= 0 && oparg < frame->f_code->co_nlocalsplus); @@ -1862,7 +1862,7 @@ TARGET(LOAD_DEREF) { PyObject *value; - #line 1364 "Python/bytecodes.c" + #line 1365 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); value = PyCell_GET(cell); if (value == NULL) { @@ -1878,7 +1878,7 @@ TARGET(STORE_DEREF) { PyObject *v = stack_pointer[-1]; - #line 1374 "Python/bytecodes.c" + #line 1375 "Python/bytecodes.c" PyObject *cell = GETLOCAL(oparg); PyObject *oldobj = PyCell_GET(cell); PyCell_SET(cell, v); @@ -1889,7 +1889,7 @@ } TARGET(COPY_FREE_VARS) { - #line 1381 "Python/bytecodes.c" + #line 1382 "Python/bytecodes.c" /* Copy closure variables to free variables */ PyCodeObject *co = frame->f_code; assert(PyFunction_Check(frame->f_funcobj)); @@ -1907,13 +1907,13 @@ TARGET(BUILD_STRING) { PyObject **pieces = (stack_pointer - oparg); PyObject *str; - #line 1394 "Python/bytecodes.c" + #line 1395 "Python/bytecodes.c" str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg); #line 1913 "Python/generated_cases.c.h" for (int _i = oparg; --_i >= 0;) { Py_DECREF(pieces[_i]); } - #line 1396 "Python/bytecodes.c" + #line 1397 "Python/bytecodes.c" if (str == NULL) { STACK_SHRINK(oparg); goto error; } #line 1919 "Python/generated_cases.c.h" STACK_SHRINK(oparg); @@ -1925,7 +1925,7 @@ TARGET(BUILD_TUPLE) { PyObject **values = (stack_pointer - oparg); PyObject *tup; - #line 1400 "Python/bytecodes.c" + #line 1401 "Python/bytecodes.c" tup = _PyTuple_FromArraySteal(values, oparg); if (tup == NULL) { STACK_SHRINK(oparg); goto error; } #line 1932 "Python/generated_cases.c.h" @@ -1938,7 +1938,7 @@ TARGET(BUILD_LIST) { PyObject **values = (stack_pointer - oparg); PyObject *list; - #line 1405 "Python/bytecodes.c" + #line 1406 "Python/bytecodes.c" list = _PyList_FromArraySteal(values, oparg); if (list == NULL) { STACK_SHRINK(oparg); goto error; } #line 1945 "Python/generated_cases.c.h" @@ -1951,7 +1951,7 @@ TARGET(LIST_EXTEND) { PyObject *iterable = stack_pointer[-1]; PyObject *list = stack_pointer[-(2 + (oparg-1))]; - #line 1410 "Python/bytecodes.c" + #line 1411 "Python/bytecodes.c" PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable); if (none_val == NULL) { if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) && @@ -1964,7 +1964,7 @@ } #line 1966 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1421 "Python/bytecodes.c" + #line 1422 "Python/bytecodes.c" if (true) goto pop_1_error; } Py_DECREF(none_val); @@ -1977,11 +1977,11 @@ TARGET(SET_UPDATE) { PyObject *iterable = stack_pointer[-1]; PyObject *set = stack_pointer[-(2 + (oparg-1))]; - #line 1428 "Python/bytecodes.c" + #line 1429 "Python/bytecodes.c" int err = _PySet_Update(set, iterable); #line 1983 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 1430 "Python/bytecodes.c" + #line 1431 "Python/bytecodes.c" if (err < 0) goto pop_1_error; #line 1987 "Python/generated_cases.c.h" STACK_SHRINK(1); @@ -1991,7 +1991,7 @@ TARGET(BUILD_SET) { PyObject **values = (stack_pointer - oparg); PyObject *set; - #line 1434 "Python/bytecodes.c" + #line 1435 "Python/bytecodes.c" set = PySet_New(NULL); if (set == NULL) goto error; @@ -2016,7 +2016,7 @@ TARGET(BUILD_MAP) { PyObject **values = (stack_pointer - oparg*2); PyObject *map; - #line 1451 "Python/bytecodes.c" + #line 1452 "Python/bytecodes.c" map = _PyDict_FromItems( values, 2, values+1, 2, @@ -2028,7 +2028,7 @@ for (int _i = oparg*2; --_i >= 0;) { Py_DECREF(values[_i]); } - #line 1459 "Python/bytecodes.c" + #line 1460 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg*2); goto error; } #line 2034 "Python/generated_cases.c.h" STACK_SHRINK(oparg*2); @@ -2038,7 +2038,7 @@ } TARGET(SETUP_ANNOTATIONS) { - #line 1463 "Python/bytecodes.c" + #line 1464 "Python/bytecodes.c" int err; PyObject *ann_dict; if (LOCALS() == NULL) { @@ -2086,7 +2086,7 @@ PyObject *keys = stack_pointer[-1]; PyObject **values = (stack_pointer - (1 + oparg)); PyObject *map; - #line 1505 "Python/bytecodes.c" + #line 1506 "Python/bytecodes.c" if (!PyTuple_CheckExact(keys) || PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) { _PyErr_SetString(tstate, PyExc_SystemError, @@ -2101,7 +2101,7 @@ Py_DECREF(values[_i]); } Py_DECREF(keys); - #line 1515 "Python/bytecodes.c" + #line 1516 "Python/bytecodes.c" if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; } #line 2107 "Python/generated_cases.c.h" STACK_SHRINK(oparg); @@ -2111,7 +2111,7 @@ TARGET(DICT_UPDATE) { PyObject *update = stack_pointer[-1]; - #line 1519 "Python/bytecodes.c" + #line 1520 "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)) { @@ -2121,7 +2121,7 @@ } #line 2123 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1527 "Python/bytecodes.c" + #line 1528 "Python/bytecodes.c" if (true) goto pop_1_error; } #line 2128 "Python/generated_cases.c.h" @@ -2132,14 +2132,14 @@ TARGET(DICT_MERGE) { PyObject *update = stack_pointer[-1]; - #line 1533 "Python/bytecodes.c" + #line 1534 "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 2141 "Python/generated_cases.c.h" Py_DECREF(update); - #line 1538 "Python/bytecodes.c" + #line 1539 "Python/bytecodes.c" if (true) goto pop_1_error; } #line 2146 "Python/generated_cases.c.h" @@ -2152,7 +2152,7 @@ TARGET(MAP_ADD) { PyObject *value = stack_pointer[-1]; PyObject *key = stack_pointer[-2]; - #line 1545 "Python/bytecodes.c" + #line 1546 "Python/bytecodes.c" PyObject *dict = PEEK(oparg + 2); // key, value are still on the stack assert(PyDict_CheckExact(dict)); /* dict[key] = value */ @@ -2164,13 +2164,58 @@ DISPATCH(); } + TARGET(LOAD_ZERO_SUPER_ATTR) { + PyObject *self = stack_pointer[-1]; + PyObject *class = stack_pointer[-2]; + PyObject *global_super = stack_pointer[-3]; + PyObject *res2 = NULL; + PyObject *res; + #line 1555 "Python/bytecodes.c" + PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 1); + if (global_super == (PyObject *)&PySuper_Type) { + int meth_found = 0; + Py_DECREF(global_super); + assert(PyType_Check(class)); + res = _PySuper_Lookup((PyTypeObject *)class, self, name, oparg & 1 ? &meth_found : NULL); + Py_DECREF(class); + if (res == NULL) { + Py_DECREF(self); + if (true) goto pop_3_error; + } + if (meth_found) { + res2 = res; + res = self; // transfer ownership + } else { + res2 = NULL; + Py_DECREF(self); + } + } else { + PyObject *super = PyObject_Vectorcall(global_super, NULL, 0, NULL); + #line 2195 "Python/generated_cases.c.h" + Py_DECREF(global_super); + Py_DECREF(class); + Py_DECREF(self); + #line 1576 "Python/bytecodes.c" + if (super == NULL) goto pop_3_error; + res = PyObject_GetAttr(super, name); + Py_DECREF(super); + if (res == NULL) goto pop_3_error; + } + #line 2205 "Python/generated_cases.c.h" + STACK_SHRINK(2); + STACK_GROW(((oparg & 1) ? 1 : 0)); + stack_pointer[-1] = res; + if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } + DISPATCH(); + } + TARGET(LOAD_ATTR) { PREDICTED(LOAD_ATTR); static_assert(INLINE_CACHE_ENTRIES_LOAD_ATTR == 9, "incorrect cache size"); PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1568 "Python/bytecodes.c" + #line 1598 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2204,9 +2249,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2208 "Python/generated_cases.c.h" + #line 2253 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1602 "Python/bytecodes.c" + #line 1632 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2215,12 +2260,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2219 "Python/generated_cases.c.h" + #line 2264 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1611 "Python/bytecodes.c" + #line 1641 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2224 "Python/generated_cases.c.h" + #line 2269 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -2234,7 +2279,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1616 "Python/bytecodes.c" + #line 1646 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2247,7 +2292,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2251 "Python/generated_cases.c.h" + #line 2296 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2262,7 +2307,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1632 "Python/bytecodes.c" + #line 1662 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2275,7 +2320,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2279 "Python/generated_cases.c.h" + #line 2324 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2290,7 +2335,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1648 "Python/bytecodes.c" + #line 1678 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2317,7 +2362,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2321 "Python/generated_cases.c.h" + #line 2366 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2332,7 +2377,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1678 "Python/bytecodes.c" + #line 1708 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2342,7 +2387,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2346 "Python/generated_cases.c.h" + #line 2391 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2357,7 +2402,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1691 "Python/bytecodes.c" + #line 1721 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2369,7 +2414,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2373 "Python/generated_cases.c.h" + #line 2418 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2383,7 +2428,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 1706 "Python/bytecodes.c" + #line 1736 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2406,7 +2451,7 @@ new_frame->localsplus[0] = owner; JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); DISPATCH_INLINED(new_frame); - #line 2410 "Python/generated_cases.c.h" + #line 2455 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2414,7 +2459,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 1731 "Python/bytecodes.c" + #line 1761 "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); @@ -2439,7 +2484,7 @@ new_frame->localsplus[1] = Py_NewRef(name); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); DISPATCH_INLINED(new_frame); - #line 2443 "Python/generated_cases.c.h" + #line 2488 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2447,7 +2492,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 1758 "Python/bytecodes.c" + #line 1788 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2465,7 +2510,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2469 "Python/generated_cases.c.h" + #line 2514 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2476,7 +2521,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 1778 "Python/bytecodes.c" + #line 1808 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2515,7 +2560,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2519 "Python/generated_cases.c.h" + #line 2564 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2526,7 +2571,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 1819 "Python/bytecodes.c" + #line 1849 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2536,7 +2581,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2540 "Python/generated_cases.c.h" + #line 2585 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2548,7 +2593,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1838 "Python/bytecodes.c" + #line 1868 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2561,12 +2606,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); - #line 2565 "Python/generated_cases.c.h" + #line 2610 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1851 "Python/bytecodes.c" + #line 1881 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2570 "Python/generated_cases.c.h" + #line 2615 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2577,7 +2622,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1855 "Python/bytecodes.c" + #line 1885 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2589,7 +2634,7 @@ _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2593 "Python/generated_cases.c.h" + #line 2638 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2600,7 +2645,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1870 "Python/bytecodes.c" + #line 1900 "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); @@ -2616,7 +2661,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2620 "Python/generated_cases.c.h" + #line 2665 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2627,7 +2672,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1889 "Python/bytecodes.c" + #line 1919 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2640,7 +2685,7 @@ assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2644 "Python/generated_cases.c.h" + #line 2689 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2651,14 +2696,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1904 "Python/bytecodes.c" + #line 1934 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 2657 "Python/generated_cases.c.h" + #line 2702 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1906 "Python/bytecodes.c" + #line 1936 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2662 "Python/generated_cases.c.h" + #line 2707 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2668,15 +2713,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1910 "Python/bytecodes.c" + #line 1940 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 2674 "Python/generated_cases.c.h" + #line 2719 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1912 "Python/bytecodes.c" + #line 1942 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = Py_NewRef((res^oparg) ? Py_True : Py_False); - #line 2680 "Python/generated_cases.c.h" + #line 2725 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2687,12 +2732,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 1917 "Python/bytecodes.c" + #line 1947 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 2693 "Python/generated_cases.c.h" + #line 2738 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1919 "Python/bytecodes.c" + #line 1949 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -2700,10 +2745,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 2704 "Python/generated_cases.c.h" + #line 2749 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1927 "Python/bytecodes.c" + #line 1957 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -2712,7 +2757,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 2716 "Python/generated_cases.c.h" + #line 2761 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -2722,21 +2767,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1938 "Python/bytecodes.c" + #line 1968 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 2729 "Python/generated_cases.c.h" + #line 2774 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1941 "Python/bytecodes.c" + #line 1971 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 2736 "Python/generated_cases.c.h" + #line 2781 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1946 "Python/bytecodes.c" + #line 1976 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2740 "Python/generated_cases.c.h" + #line 2785 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -2745,15 +2790,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 1950 "Python/bytecodes.c" + #line 1980 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 2752 "Python/generated_cases.c.h" + #line 2797 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 1953 "Python/bytecodes.c" + #line 1983 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2757 "Python/generated_cases.c.h" + #line 2802 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -2762,29 +2807,29 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 1957 "Python/bytecodes.c" + #line 1987 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 2770 "Python/generated_cases.c.h" + #line 2815 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 1963 "Python/bytecodes.c" + #line 1993 "Python/bytecodes.c" JUMPBY(oparg); - #line 2779 "Python/generated_cases.c.h" + #line 2824 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); - #line 1967 "Python/bytecodes.c" + #line 1997 "Python/bytecodes.c" assert(oparg < INSTR_OFFSET()); JUMPBY(-oparg); - #line 2788 "Python/generated_cases.c.h" + #line 2833 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } @@ -2792,7 +2837,7 @@ TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; - #line 1973 "Python/bytecodes.c" + #line 2003 "Python/bytecodes.c" if (Py_IsTrue(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2802,9 +2847,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2806 "Python/generated_cases.c.h" + #line 2851 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 1983 "Python/bytecodes.c" + #line 2013 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -2812,14 +2857,14 @@ if (err < 0) goto pop_1_error; } } - #line 2816 "Python/generated_cases.c.h" + #line 2861 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 1993 "Python/bytecodes.c" + #line 2023 "Python/bytecodes.c" if (Py_IsFalse(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2829,9 +2874,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2833 "Python/generated_cases.c.h" + #line 2878 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2003 "Python/bytecodes.c" + #line 2033 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -2839,67 +2884,67 @@ if (err < 0) goto pop_1_error; } } - #line 2843 "Python/generated_cases.c.h" + #line 2888 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2013 "Python/bytecodes.c" + #line 2043 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 2852 "Python/generated_cases.c.h" + #line 2897 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2015 "Python/bytecodes.c" + #line 2045 "Python/bytecodes.c" JUMPBY(oparg); } else { _Py_DECREF_NO_DEALLOC(value); } - #line 2860 "Python/generated_cases.c.h" + #line 2905 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2023 "Python/bytecodes.c" + #line 2053 "Python/bytecodes.c" if (Py_IsNone(value)) { _Py_DECREF_NO_DEALLOC(value); JUMPBY(oparg); } else { - #line 2873 "Python/generated_cases.c.h" + #line 2918 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2029 "Python/bytecodes.c" + #line 2059 "Python/bytecodes.c" } - #line 2877 "Python/generated_cases.c.h" + #line 2922 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2033 "Python/bytecodes.c" + #line 2063 "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. * (see bpo-30039). */ JUMPBY(-oparg); - #line 2890 "Python/generated_cases.c.h" + #line 2935 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2042 "Python/bytecodes.c" + #line 2072 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 2903 "Python/generated_cases.c.h" + #line 2948 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -2910,16 +2955,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2050 "Python/bytecodes.c" + #line 2080 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 2919 "Python/generated_cases.c.h" + #line 2964 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2055 "Python/bytecodes.c" + #line 2085 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -2927,7 +2972,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_NewRef(Py_None); // Failure! } - #line 2931 "Python/generated_cases.c.h" + #line 2976 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -2936,10 +2981,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2065 "Python/bytecodes.c" + #line 2095 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = Py_NewRef(match ? Py_True : Py_False); - #line 2943 "Python/generated_cases.c.h" + #line 2988 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -2949,10 +2994,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2071 "Python/bytecodes.c" + #line 2101 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = Py_NewRef(match ? Py_True : Py_False); - #line 2956 "Python/generated_cases.c.h" + #line 3001 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -2963,11 +3008,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2077 "Python/bytecodes.c" + #line 2107 "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; - #line 2971 "Python/generated_cases.c.h" + #line 3016 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -2976,14 +3021,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2083 "Python/bytecodes.c" + #line 2113 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 2983 "Python/generated_cases.c.h" + #line 3028 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2086 "Python/bytecodes.c" + #line 2116 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 2987 "Python/generated_cases.c.h" + #line 3032 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -2991,7 +3036,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2090 "Python/bytecodes.c" + #line 2120 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3014,11 +3059,11 @@ if (iter == NULL) { goto error; } - #line 3018 "Python/generated_cases.c.h" + #line 3063 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2113 "Python/bytecodes.c" + #line 2143 "Python/bytecodes.c" } - #line 3022 "Python/generated_cases.c.h" + #line 3067 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -3029,7 +3074,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2132 "Python/bytecodes.c" + #line 2162 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3060,7 +3105,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3064 "Python/generated_cases.c.h" + #line 3109 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3068,7 +3113,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2165 "Python/bytecodes.c" + #line 2195 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3094,14 +3139,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3098 "Python/generated_cases.c.h" + #line 3143 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2193 "Python/bytecodes.c" + #line 2223 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3121,7 +3166,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3125 "Python/generated_cases.c.h" + #line 3170 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3131,7 +3176,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2215 "Python/bytecodes.c" + #line 2245 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3151,7 +3196,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3155 "Python/generated_cases.c.h" + #line 3200 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3161,7 +3206,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2237 "Python/bytecodes.c" + #line 2267 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3179,7 +3224,7 @@ if (next == NULL) { goto error; } - #line 3183 "Python/generated_cases.c.h" + #line 3228 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3188,7 +3233,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2257 "Python/bytecodes.c" + #line 2287 "Python/bytecodes.c" PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, FOR_ITER); @@ -3203,14 +3248,14 @@ assert(next_instr->op.code == END_FOR || next_instr->op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3207 "Python/generated_cases.c.h" + #line 3252 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2274 "Python/bytecodes.c" + #line 2304 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3233,16 +3278,16 @@ Py_DECREF(enter); goto error; } - #line 3237 "Python/generated_cases.c.h" + #line 3282 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2297 "Python/bytecodes.c" + #line 2327 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3246 "Python/generated_cases.c.h" + #line 3291 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3254,7 +3299,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2307 "Python/bytecodes.c" + #line 2337 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3280,16 +3325,16 @@ Py_DECREF(enter); goto error; } - #line 3284 "Python/generated_cases.c.h" + #line 3329 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2333 "Python/bytecodes.c" + #line 2363 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3293 "Python/generated_cases.c.h" + #line 3338 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3301,7 +3346,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2342 "Python/bytecodes.c" + #line 2372 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3322,7 +3367,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3326 "Python/generated_cases.c.h" + #line 3371 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3331,7 +3376,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2365 "Python/bytecodes.c" + #line 2395 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3341,7 +3386,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3345 "Python/generated_cases.c.h" + #line 3390 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3355,7 +3400,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 2377 "Python/bytecodes.c" + #line 2407 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3372,7 +3417,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3376 "Python/generated_cases.c.h" + #line 3421 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3386,7 +3431,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2396 "Python/bytecodes.c" + #line 2426 "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); @@ -3396,7 +3441,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3400 "Python/generated_cases.c.h" + #line 3445 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3410,7 +3455,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2408 "Python/bytecodes.c" + #line 2438 "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; @@ -3424,7 +3469,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3428 "Python/generated_cases.c.h" + #line 3473 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3433,16 +3478,16 @@ } TARGET(KW_NAMES) { - #line 2424 "Python/bytecodes.c" + #line 2454 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(frame->f_code->co_consts)); kwnames = GETITEM(frame->f_code->co_consts, oparg); - #line 3441 "Python/generated_cases.c.h" + #line 3486 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2430 "Python/bytecodes.c" + #line 2460 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3455,7 +3500,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3459 "Python/generated_cases.c.h" + #line 3504 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3465,7 +3510,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2475 "Python/bytecodes.c" + #line 2505 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3546,7 +3591,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3550 "Python/generated_cases.c.h" + #line 3595 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3558,7 +3603,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2562 "Python/bytecodes.c" + #line 2592 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3568,7 +3613,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3572 "Python/generated_cases.c.h" + #line 3617 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3577,7 +3622,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2574 "Python/bytecodes.c" + #line 2604 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3602,7 +3647,7 @@ STACK_SHRINK(oparg + 2); JUMPBY(INLINE_CACHE_ENTRIES_CALL); DISPATCH_INLINED(new_frame); - #line 3606 "Python/generated_cases.c.h" + #line 3651 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3610,7 +3655,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2601 "Python/bytecodes.c" + #line 2631 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3645,7 +3690,7 @@ STACK_SHRINK(oparg + 2); JUMPBY(INLINE_CACHE_ENTRIES_CALL); DISPATCH_INLINED(new_frame); - #line 3649 "Python/generated_cases.c.h" + #line 3694 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -3653,7 +3698,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2638 "Python/bytecodes.c" + #line 2668 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3663,7 +3708,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 3667 "Python/generated_cases.c.h" + #line 3712 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3676,7 +3721,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2650 "Python/bytecodes.c" + #line 2680 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3687,7 +3732,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3691 "Python/generated_cases.c.h" + #line 3736 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3701,7 +3746,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2664 "Python/bytecodes.c" + #line 2694 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3712,7 +3757,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3716 "Python/generated_cases.c.h" + #line 3761 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3726,7 +3771,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2678 "Python/bytecodes.c" + #line 2708 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3748,7 +3793,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3752 "Python/generated_cases.c.h" + #line 3797 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3762,7 +3807,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2703 "Python/bytecodes.c" + #line 2733 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3790,7 +3835,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3794 "Python/generated_cases.c.h" + #line 3839 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3804,7 +3849,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2734 "Python/bytecodes.c" + #line 2764 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3836,7 +3881,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 3840 "Python/generated_cases.c.h" + #line 3885 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3850,7 +3895,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2769 "Python/bytecodes.c" + #line 2799 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -3882,7 +3927,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3886 "Python/generated_cases.c.h" + #line 3931 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3896,7 +3941,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2804 "Python/bytecodes.c" + #line 2834 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -3921,7 +3966,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3925 "Python/generated_cases.c.h" + #line 3970 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3934,7 +3979,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2831 "Python/bytecodes.c" + #line 2861 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -3961,7 +4006,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3965 "Python/generated_cases.c.h" + #line 4010 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3973,7 +4018,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2861 "Python/bytecodes.c" + #line 2891 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -3991,14 +4036,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 3995 "Python/generated_cases.c.h" + #line 4040 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2881 "Python/bytecodes.c" + #line 2911 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4029,7 +4074,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4033 "Python/generated_cases.c.h" + #line 4078 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4042,7 +4087,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2915 "Python/bytecodes.c" + #line 2945 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4071,7 +4116,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4075 "Python/generated_cases.c.h" + #line 4120 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4084,7 +4129,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2947 "Python/bytecodes.c" + #line 2977 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4113,7 +4158,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4117 "Python/generated_cases.c.h" + #line 4162 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4126,7 +4171,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2979 "Python/bytecodes.c" + #line 3009 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4154,7 +4199,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4158 "Python/generated_cases.c.h" + #line 4203 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4164,9 +4209,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3010 "Python/bytecodes.c" + #line 3040 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4170 "Python/generated_cases.c.h" + #line 4215 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4175,7 +4220,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3014 "Python/bytecodes.c" + #line 3044 "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)); @@ -4218,14 +4263,14 @@ else { result = PyObject_Call(func, callargs, kwargs); } - #line 4222 "Python/generated_cases.c.h" + #line 4267 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3057 "Python/bytecodes.c" + #line 3087 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4229 "Python/generated_cases.c.h" + #line 4274 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4240,7 +4285,7 @@ PyObject *kwdefaults = (oparg & 0x02) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0))] : NULL; PyObject *defaults = (oparg & 0x01) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x01) ? 1 : 0))] : NULL; PyObject *func; - #line 3067 "Python/bytecodes.c" + #line 3097 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4269,14 +4314,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4273 "Python/generated_cases.c.h" + #line 4318 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 0x01) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x08) ? 1 : 0)); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3098 "Python/bytecodes.c" + #line 3128 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4297,7 +4342,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4301 "Python/generated_cases.c.h" + #line 4346 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4305,15 +4350,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3121 "Python/bytecodes.c" + #line 3151 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4311 "Python/generated_cases.c.h" + #line 4356 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3123 "Python/bytecodes.c" + #line 3153 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4317 "Python/generated_cases.c.h" + #line 4362 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4324,7 +4369,7 @@ 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))]; PyObject *result; - #line 3127 "Python/bytecodes.c" + #line 3157 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4359,7 +4404,7 @@ 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 4363 "Python/generated_cases.c.h" + #line 4408 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4368,10 +4413,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3164 "Python/bytecodes.c" + #line 3194 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4375 "Python/generated_cases.c.h" + #line 4420 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4383,7 +4428,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3169 "Python/bytecodes.c" + #line 3199 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4398,12 +4443,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4402 "Python/generated_cases.c.h" + #line 4447 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3184 "Python/bytecodes.c" + #line 3214 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4407 "Python/generated_cases.c.h" + #line 4452 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4413,16 +4458,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3189 "Python/bytecodes.c" + #line 3219 "Python/bytecodes.c" assert(oparg >= 2); - #line 4419 "Python/generated_cases.c.h" + #line 4464 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_LINE) { - #line 3193 "Python/bytecodes.c" + #line 3223 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _PyFrame_SetStackPointer(frame, stack_pointer); int original_opcode = _Py_call_instrumentation_line( @@ -4442,11 +4487,11 @@ } opcode = original_opcode; DISPATCH_GOTO(); - #line 4446 "Python/generated_cases.c.h" + #line 4491 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3215 "Python/bytecodes.c" + #line 3245 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4458,26 +4503,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4462 "Python/generated_cases.c.h" + #line 4507 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3229 "Python/bytecodes.c" + #line 3259 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4468 "Python/generated_cases.c.h" + #line 4513 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3233 "Python/bytecodes.c" + #line 3263 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr-oparg, PY_MONITORING_EVENT_JUMP); - #line 4475 "Python/generated_cases.c.h" + #line 4520 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3238 "Python/bytecodes.c" + #line 3268 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4486,12 +4531,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4490 "Python/generated_cases.c.h" + #line 4535 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3249 "Python/bytecodes.c" + #line 3279 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4500,12 +4545,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4504 "Python/generated_cases.c.h" + #line 4549 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3260 "Python/bytecodes.c" + #line 3290 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4518,12 +4563,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4522 "Python/generated_cases.c.h" + #line 4567 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3275 "Python/bytecodes.c" + #line 3305 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4536,30 +4581,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4540 "Python/generated_cases.c.h" + #line 4585 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3290 "Python/bytecodes.c" + #line 3320 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4551 "Python/generated_cases.c.h" + #line 4596 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3298 "Python/bytecodes.c" + #line 3328 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4558 "Python/generated_cases.c.h" + #line 4603 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3303 "Python/bytecodes.c" + #line 3333 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4565 "Python/generated_cases.c.h" + #line 4610 "Python/generated_cases.c.h" } diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h index 4681ed03aff582..841d1ab95a746e 100644 --- a/Python/opcode_metadata.h +++ b/Python/opcode_metadata.h @@ -205,6 +205,8 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) { return 1; case MAP_ADD: return 2; + case LOAD_ZERO_SUPER_ATTR: + return 3; case LOAD_ATTR: return 1; case LOAD_ATTR_INSTANCE_VALUE: @@ -589,6 +591,8 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { return 0; case MAP_ADD: return 0; + case LOAD_ZERO_SUPER_ATTR: + return ((oparg & 1) ? 1 : 0) + 1; case LOAD_ATTR: return ((oparg & 1) ? 1 : 0) + 1; case LOAD_ATTR_INSTANCE_VALUE: @@ -879,6 +883,7 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { [DICT_UPDATE] = { true, INSTR_FMT_IB }, [DICT_MERGE] = { true, INSTR_FMT_IB }, [MAP_ADD] = { true, INSTR_FMT_IB }, + [LOAD_ZERO_SUPER_ATTR] = { true, INSTR_FMT_IB }, [LOAD_ATTR] = { true, INSTR_FMT_IBC00000000 }, [LOAD_ATTR_INSTANCE_VALUE] = { true, INSTR_FMT_IBC00000000 }, [LOAD_ATTR_MODULE] = { true, INSTR_FMT_IBC00000000 }, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 9d6616666f7ac1..10d191747c228e 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -140,9 +140,9 @@ static void *opcode_targets[256] = { &&TARGET_STORE_DEREF, &&TARGET_DELETE_DEREF, &&TARGET_JUMP_BACKWARD, - &&TARGET_STORE_FAST__STORE_FAST, + &&TARGET_LOAD_ZERO_SUPER_ATTR, &&TARGET_CALL_FUNCTION_EX, - &&TARGET_STORE_SUBSCR_DICT, + &&TARGET_STORE_FAST__STORE_FAST, &&TARGET_EXTENDED_ARG, &&TARGET_LIST_APPEND, &&TARGET_SET_ADD, @@ -152,15 +152,15 @@ static void *opcode_targets[256] = { &&TARGET_YIELD_VALUE, &&TARGET_RESUME, &&TARGET_MATCH_CLASS, + &&TARGET_STORE_SUBSCR_DICT, &&TARGET_STORE_SUBSCR_LIST_INT, - &&TARGET_UNPACK_SEQUENCE_LIST, &&TARGET_FORMAT_VALUE, &&TARGET_BUILD_CONST_KEY_MAP, &&TARGET_BUILD_STRING, + &&TARGET_UNPACK_SEQUENCE_LIST, &&TARGET_UNPACK_SEQUENCE_TUPLE, &&TARGET_UNPACK_SEQUENCE_TWO_TUPLE, &&TARGET_SEND_GEN, - &&_unknown_opcode, &&TARGET_LIST_EXTEND, &&TARGET_SET_UPDATE, &&TARGET_DICT_MERGE, From f14a3bf166a8a45059259cdc2d2e5ad2754e7a7c Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 12 Apr 2023 20:22:10 -0700 Subject: [PATCH 02/16] add news entry --- .../2023-04-12-20-22-03.gh-issue-87729.99A7UO.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-22-03.gh-issue-87729.99A7UO.rst diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-22-03.gh-issue-87729.99A7UO.rst b/Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-22-03.gh-issue-87729.99A7UO.rst new file mode 100644 index 00000000000000..9b09190c96e449 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-22-03.gh-issue-87729.99A7UO.rst @@ -0,0 +1 @@ +Speed up ``super().meth()`` calls. From 5625e73e323ff9eba822e9b70521a5c02399e230 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 12 Apr 2023 21:32:36 -0700 Subject: [PATCH 03/16] document LOAD_ZERO_SUPER_ATTR --- Doc/library/dis.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 19c08b225ef2bc..11c81dcef14fbb 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1036,6 +1036,18 @@ iterations of the loop. pushed to the stack before the attribute or unbound method respectively. +.. opcode:: LOAD_ZERO_SUPER_ATTR (namei) + + This opcode implements zero-argument :func:`super` (i.e. ``super().method()`` + and ``super().attr``). It works the same as :opcode:`LOAD_ATTR`, except that + instead of expecting a single receiver on the stack, it expects three objects + (from top of stack down): ``self`` (the first argument to the current + method), ``cls`` (the class within which the current method was defined), and + the global ``super``. + + .. versionadded:: 3.12 + + .. opcode:: COMPARE_OP (opname) Performs a Boolean operation. The operation name can be found in From 0775efeed11c0fe734ad2f7ee5f757cfedfab61d Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 12 Apr 2023 21:48:56 -0700 Subject: [PATCH 04/16] fix gdb test_wrapper_call --- Lib/test/test_gdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py index 0f39b8f45714ad..311a864a52387d 100644 --- a/Lib/test/test_gdb.py +++ b/Lib/test/test_gdb.py @@ -962,7 +962,7 @@ def test_wrapper_call(self): cmd = textwrap.dedent(''' class MyList(list): def __init__(self): - super().__init__() # wrapper_call() + super(*[]).__init__() # wrapper_call() id("first break point") l = MyList() From f229b5bdf08fb21f64b7de91f07eedb1ec879096 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 12 Apr 2023 22:52:29 -0700 Subject: [PATCH 05/16] optimize 2-arg super also --- Doc/library/dis.rst | 22 +- Include/internal/pycore_opcode.h | 8 +- Include/opcode.h | 10 +- Lib/dis.py | 8 +- Lib/opcode.py | 6 +- Lib/test/test_super.py | 15 + Python/bytecodes.c | 12 +- Python/compile.c | 71 ++++- Python/generated_cases.c.h | 458 ++++++++++++++++--------------- Python/opcode_metadata.h | 6 +- Python/opcode_targets.h | 2 +- 11 files changed, 353 insertions(+), 265 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 11c81dcef14fbb..c8897b34f0ddfd 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1036,14 +1036,20 @@ iterations of the loop. pushed to the stack before the attribute or unbound method respectively. -.. opcode:: LOAD_ZERO_SUPER_ATTR (namei) - - This opcode implements zero-argument :func:`super` (i.e. ``super().method()`` - and ``super().attr``). It works the same as :opcode:`LOAD_ATTR`, except that - instead of expecting a single receiver on the stack, it expects three objects - (from top of stack down): ``self`` (the first argument to the current - method), ``cls`` (the class within which the current method was defined), and - the global ``super``. +.. opcode:: LOAD_SUPER_ATTR (namei) + + This opcode implements :func:`super` (e.g. ``super().method()`` and + ``super().attr``). It works the same as :opcode:`LOAD_ATTR`, except that + ``namei`` is shifted left by 2 bits instead of 1, and instead of expecting a + single receiver on the stack, it expects three objects (from top of stack + down): ``self`` (the first argument to the current method), ``cls`` (the + class within which the current method was defined), and the global ``super``. + + The low bit of ``namei`` signals to attempt a method load, as with + :opcode:`LOAD_ATTR`. + + The second-low bit of ``namei``, if set, means that this was a zero-argument + call to :func:`super`. .. versionadded:: 3.12 diff --git a/Include/internal/pycore_opcode.h b/Include/internal/pycore_opcode.h index 39fe2ca62de1a6..529b08fadb3ad7 100644 --- a/Include/internal/pycore_opcode.h +++ b/Include/internal/pycore_opcode.h @@ -179,7 +179,7 @@ const uint8_t _PyOpcode_Deopt[256] = { [LOAD_GLOBAL_BUILTIN] = LOAD_GLOBAL, [LOAD_GLOBAL_MODULE] = LOAD_GLOBAL, [LOAD_NAME] = LOAD_NAME, - [LOAD_ZERO_SUPER_ATTR] = LOAD_ZERO_SUPER_ATTR, + [LOAD_SUPER_ATTR] = LOAD_SUPER_ATTR, [MAKE_CELL] = MAKE_CELL, [MAKE_FUNCTION] = MAKE_FUNCTION, [MAP_ADD] = MAP_ADD, @@ -237,7 +237,7 @@ const uint8_t _PyOpcode_Deopt[256] = { #endif // NEED_OPCODE_TABLES #ifdef Py_DEBUG -static const char *const _PyOpcode_OpName[264] = { +static const char *const _PyOpcode_OpName[266] = { [CACHE] = "CACHE", [POP_TOP] = "POP_TOP", [PUSH_NULL] = "PUSH_NULL", @@ -379,7 +379,7 @@ static const char *const _PyOpcode_OpName[264] = { [STORE_DEREF] = "STORE_DEREF", [DELETE_DEREF] = "DELETE_DEREF", [JUMP_BACKWARD] = "JUMP_BACKWARD", - [LOAD_ZERO_SUPER_ATTR] = "LOAD_ZERO_SUPER_ATTR", + [LOAD_SUPER_ATTR] = "LOAD_SUPER_ATTR", [CALL_FUNCTION_EX] = "CALL_FUNCTION_EX", [STORE_FAST__STORE_FAST] = "STORE_FAST__STORE_FAST", [EXTENDED_ARG] = "EXTENDED_ARG", @@ -501,7 +501,9 @@ static const char *const _PyOpcode_OpName[264] = { [JUMP] = "JUMP", [JUMP_NO_INTERRUPT] = "JUMP_NO_INTERRUPT", [LOAD_METHOD] = "LOAD_METHOD", + [LOAD_SUPER_METHOD] = "LOAD_SUPER_METHOD", [LOAD_ZERO_SUPER_METHOD] = "LOAD_ZERO_SUPER_METHOD", + [LOAD_ZERO_SUPER_ATTR] = "LOAD_ZERO_SUPER_ATTR", }; #endif diff --git a/Include/opcode.h b/Include/opcode.h index 22e598ff5bf28f..76e9bc870d4bed 100644 --- a/Include/opcode.h +++ b/Include/opcode.h @@ -95,7 +95,7 @@ extern "C" { #define STORE_DEREF 138 #define DELETE_DEREF 139 #define JUMP_BACKWARD 140 -#define LOAD_ZERO_SUPER_ATTR 141 +#define LOAD_SUPER_ATTR 141 #define CALL_FUNCTION_EX 142 #define EXTENDED_ARG 144 #define LIST_APPEND 145 @@ -143,8 +143,10 @@ extern "C" { #define JUMP 260 #define JUMP_NO_INTERRUPT 261 #define LOAD_METHOD 262 -#define LOAD_ZERO_SUPER_METHOD 263 -#define MAX_PSEUDO_OPCODE 263 +#define LOAD_SUPER_METHOD 263 +#define LOAD_ZERO_SUPER_METHOD 264 +#define LOAD_ZERO_SUPER_ATTR 265 +#define MAX_PSEUDO_OPCODE 265 #define BINARY_OP_ADD_FLOAT 6 #define BINARY_OP_ADD_INT 7 #define BINARY_OP_ADD_UNICODE 8 @@ -212,7 +214,9 @@ extern "C" { || ((op) == JUMP) \ || ((op) == JUMP_NO_INTERRUPT) \ || ((op) == LOAD_METHOD) \ + || ((op) == LOAD_SUPER_METHOD) \ || ((op) == LOAD_ZERO_SUPER_METHOD) \ + || ((op) == LOAD_ZERO_SUPER_ATTR) \ ) #define HAS_CONST(op) (false\ diff --git a/Lib/dis.py b/Lib/dis.py index 565c6bad8fe5ee..3a74f72d3b1077 100644 --- a/Lib/dis.py +++ b/Lib/dis.py @@ -41,7 +41,7 @@ FOR_ITER = opmap['FOR_ITER'] SEND = opmap['SEND'] LOAD_ATTR = opmap['LOAD_ATTR'] -LOAD_ZERO_SUPER_ATTR = opmap['LOAD_ZERO_SUPER_ATTR'] +LOAD_SUPER_ATTR = opmap['LOAD_SUPER_ATTR'] CACHE = opmap["CACHE"] @@ -472,10 +472,14 @@ def _get_instructions_bytes(code, varname_from_oparg=None, argval, argrepr = _get_name_info(arg//2, get_name) if (arg & 1) and argrepr: argrepr = "NULL + " + argrepr - elif deop == LOAD_ATTR or deop == LOAD_ZERO_SUPER_ATTR: + elif deop == LOAD_ATTR: argval, argrepr = _get_name_info(arg//2, get_name) if (arg & 1) and argrepr: argrepr = "NULL|self + " + argrepr + elif deop == LOAD_SUPER_ATTR: + argval, argrepr = _get_name_info(arg//4, get_name) + if (arg & 1) and argrepr: + argrepr = "NULL|self + " + argrepr else: argval, argrepr = _get_name_info(arg, get_name) elif deop in hasjabs: diff --git a/Lib/opcode.py b/Lib/opcode.py index 68c3ce80b52a67..e7b346e8ec291f 100644 --- a/Lib/opcode.py +++ b/Lib/opcode.py @@ -196,7 +196,7 @@ def pseudo_op(name, op, real_ops): def_op('DELETE_DEREF', 139) hasfree.append(139) jrel_op('JUMP_BACKWARD', 140) # Number of words to skip (backwards) -name_op('LOAD_ZERO_SUPER_ATTR', 141) +name_op('LOAD_SUPER_ATTR', 141) def_op('CALL_FUNCTION_EX', 142) # Flags def_op('EXTENDED_ARG', 144) @@ -264,7 +264,9 @@ def pseudo_op(name, op, real_ops): pseudo_op('JUMP_NO_INTERRUPT', 261, ['JUMP_FORWARD', 'JUMP_BACKWARD_NO_INTERRUPT']) pseudo_op('LOAD_METHOD', 262, ['LOAD_ATTR']) -pseudo_op('LOAD_ZERO_SUPER_METHOD', 263, ['LOAD_ZERO_SUPER_ATTR']) +pseudo_op('LOAD_SUPER_METHOD', 263, ['LOAD_SUPER_ATTR']) +pseudo_op('LOAD_ZERO_SUPER_METHOD', 264, ['LOAD_SUPER_ATTR']) +pseudo_op('LOAD_ZERO_SUPER_ATTR', 265, ['LOAD_SUPER_ATTR']) MAX_PSEUDO_OPCODE = MIN_PSEUDO_OPCODE + len(_pseudo_ops) - 1 diff --git a/Lib/test/test_super.py b/Lib/test/test_super.py index e76abfde924b05..d4f146aed5aa85 100644 --- a/Lib/test/test_super.py +++ b/Lib/test/test_super.py @@ -362,6 +362,21 @@ def method(self): with patch("test.test_super.super", MySuper) as m: self.assertEqual(C().method(), "super super") + def test_shadowed_dynamic_two_arg(self): + call_args = [] + class MySuper: + def __init__(self, *args): + call_args.append(args) + msg = "super super" + + class C: + def method(self): + return super(1, 2).msg + + with patch("test.test_super.super", MySuper) as m: + self.assertEqual(C().method(), "super super") + self.assertEqual(call_args, [(1, 2)]) + def test_attribute_error(self): class C: def method(self): diff --git a/Python/bytecodes.c b/Python/bytecodes.c index f6b56158faf1fb..62776618ad427d 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -1551,8 +1551,8 @@ dummy_func( PREDICT(JUMP_BACKWARD); } - inst(LOAD_ZERO_SUPER_ATTR, (global_super, class, self -- res2 if (oparg & 1), res)) { - PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 1); + inst(LOAD_SUPER_ATTR, (global_super, class, self -- res2 if (oparg & 1), res)) { + PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); if (global_super == (PyObject *)&PySuper_Type) { int meth_found = 0; Py_DECREF(global_super); @@ -1571,7 +1571,13 @@ dummy_func( Py_DECREF(self); } } else { - PyObject *super = PyObject_Vectorcall(global_super, NULL, 0, NULL); + PyObject *super; + if (oparg & 2) { + super = PyObject_Vectorcall(global_super, NULL, 0, NULL); + } else { + PyObject *stack[] = {class, self}; + super = PyObject_Vectorcall(global_super, stack, 2, NULL); + } DECREF_INPUTS(); ERROR_IF(super == NULL, error); res = PyObject_GetAttr(super, name); diff --git a/Python/compile.c b/Python/compile.c index cffc124dbd1556..bcef92665bcb9c 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -829,7 +829,9 @@ stack_effect(int opcode, int oparg, int jump) case LOAD_METHOD: return 1; + case LOAD_SUPER_METHOD: case LOAD_ZERO_SUPER_METHOD: + case LOAD_ZERO_SUPER_ATTR: return -1; default: return PY_INVALID_STACK_EFFECT; @@ -1041,7 +1043,7 @@ compiler_addop_name(struct compiler_unit *u, location loc, if (arg < 0) { return ERROR; } - if (opcode == LOAD_ATTR || opcode == LOAD_ZERO_SUPER_ATTR) { + if (opcode == LOAD_ATTR) { arg <<= 1; } if (opcode == LOAD_METHOD) { @@ -1049,11 +1051,24 @@ compiler_addop_name(struct compiler_unit *u, location loc, arg <<= 1; arg |= 1; } - if (opcode == LOAD_ZERO_SUPER_METHOD) { - opcode = LOAD_ZERO_SUPER_ATTR; - arg <<= 1; + if (opcode == LOAD_SUPER_ATTR) { + arg <<= 2; + } + if (opcode == LOAD_SUPER_METHOD) { + opcode = LOAD_SUPER_ATTR; + arg <<= 2; arg |= 1; } + if (opcode == LOAD_ZERO_SUPER_ATTR) { + opcode = LOAD_SUPER_ATTR; + arg <<= 2; + arg |= 2; + } + if (opcode == LOAD_ZERO_SUPER_METHOD) { + opcode = LOAD_SUPER_ATTR; + arg <<= 2; + arg |= 3; + } return codegen_addop_i(&u->u_instr_sequence, opcode, arg, loc); } @@ -4222,15 +4237,15 @@ is_import_originated(struct compiler *c, expr_ty e) } static int -is_zero_arg_super_call(struct compiler *c, expr_ty e) +can_optimize_super_call(struct compiler *c, expr_ty e) { if (e->kind != Call_kind || e->v.Call.func->kind != Name_kind || !_PyUnicode_EqualToASCIIString(e->v.Call.func->v.Name.id, "super") || - asdl_seq_LEN(e->v.Call.args) != 0 || asdl_seq_LEN(e->v.Call.keywords) != 0) { return 0; } + Py_ssize_t num_args = asdl_seq_LEN(e->v.Call.args); PyObject *super_name = e->v.Call.func->v.Name.id; // try to detect statically-visible shadowing of 'super' name @@ -4242,6 +4257,24 @@ is_zero_arg_super_call(struct compiler *c, expr_ty e) if (scope != 0) { return 0; } + + if (num_args == 2) { + for (Py_ssize_t i = 0; i < num_args; i++) { + expr_ty elt = asdl_seq_GET(e->v.Call.args, i); + if (elt->kind == Starred_kind) { + return 0; + } + } + // exactly two non-starred args; we can just load + // the provided args + return 1; + } + + if (num_args != 0) { + return 0; + } + // we need the following for zero-arg super(): + // enclosing function should have at least one argument if (c->u->u_metadata.u_argcount == 0 && c->u->u_metadata.u_posonlyargcount == 0) { @@ -4255,13 +4288,19 @@ is_zero_arg_super_call(struct compiler *c, expr_ty e) } static int -load_args_for_zero_super(struct compiler *c, expr_ty e) { +load_args_for_super(struct compiler *c, expr_ty e) { location loc = LOC(e); // load super() global - PyObject *super_name = e->v.Attribute.value->v.Call.func->v.Name.id; + PyObject *super_name = e->v.Call.func->v.Name.id; RETURN_IF_ERROR(compiler_nameop(c, loc, super_name, Load)); + if (asdl_seq_LEN(e->v.Call.args) == 2) { + VISIT(c, expr, asdl_seq_GET(e->v.Call.args, 0)); + VISIT(c, expr, asdl_seq_GET(e->v.Call.args, 1)); + return SUCCESS; + } + // load __class__ cell PyObject *name = &_Py_ID(__class__); assert(get_ref_type(c, name) == FREE); @@ -4349,9 +4388,11 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e) /* Alright, we can optimize the code. */ location loc = LOC(meth); - if (is_zero_arg_super_call(c, meth->v.Attribute.value)) { - RETURN_IF_ERROR(load_args_for_zero_super(c, meth)); - ADDOP_NAME(c, loc, LOAD_ZERO_SUPER_METHOD, meth->v.Attribute.attr, names); + if (can_optimize_super_call(c, meth->v.Attribute.value)) { + RETURN_IF_ERROR(load_args_for_super(c, meth->v.Attribute.value)); + int opcode = asdl_seq_LEN(meth->v.Attribute.value->v.Call.args) ? + LOAD_SUPER_METHOD : LOAD_ZERO_SUPER_METHOD; + ADDOP_NAME(c, loc, opcode, meth->v.Attribute.attr, names); } else { VISIT(c, expr, meth->v.Attribute.value); loc = update_start_location_to_match_attr(c, loc, meth); @@ -5365,9 +5406,11 @@ compiler_visit_expr1(struct compiler *c, expr_ty e) return compiler_formatted_value(c, e); /* The following exprs can be assignment targets. */ case Attribute_kind: - if (e->v.Attribute.ctx == Load && is_zero_arg_super_call(c, e->v.Attribute.value)) { - RETURN_IF_ERROR(load_args_for_zero_super(c, e)); - ADDOP_NAME(c, loc, LOAD_ZERO_SUPER_ATTR, e->v.Attribute.attr, names); + if (e->v.Attribute.ctx == Load && can_optimize_super_call(c, e->v.Attribute.value)) { + RETURN_IF_ERROR(load_args_for_super(c, e->v.Attribute.value)); + int opcode = asdl_seq_LEN(e->v.Attribute.value->v.Call.args) ? + LOAD_SUPER_ATTR : LOAD_ZERO_SUPER_ATTR; + ADDOP_NAME(c, loc, opcode, e->v.Attribute.attr, names); return SUCCESS; } VISIT(c, expr, e->v.Attribute.value); diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 434605903be99c..036b8861dcb512 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -2164,14 +2164,14 @@ DISPATCH(); } - TARGET(LOAD_ZERO_SUPER_ATTR) { + TARGET(LOAD_SUPER_ATTR) { PyObject *self = stack_pointer[-1]; PyObject *class = stack_pointer[-2]; PyObject *global_super = stack_pointer[-3]; PyObject *res2 = NULL; PyObject *res; #line 1555 "Python/bytecodes.c" - PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 1); + PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); if (global_super == (PyObject *)&PySuper_Type) { int meth_found = 0; Py_DECREF(global_super); @@ -2190,18 +2190,24 @@ Py_DECREF(self); } } else { - PyObject *super = PyObject_Vectorcall(global_super, NULL, 0, NULL); - #line 2195 "Python/generated_cases.c.h" + PyObject *super; + if (oparg & 2) { + super = PyObject_Vectorcall(global_super, NULL, 0, NULL); + } else { + PyObject *stack[] = {class, self}; + super = PyObject_Vectorcall(global_super, stack, 2, NULL); + } + #line 2201 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1576 "Python/bytecodes.c" + #line 1582 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); if (res == NULL) goto pop_3_error; } - #line 2205 "Python/generated_cases.c.h" + #line 2211 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2215,7 +2221,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1598 "Python/bytecodes.c" + #line 1604 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2249,9 +2255,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2253 "Python/generated_cases.c.h" + #line 2259 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1632 "Python/bytecodes.c" + #line 1638 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2260,12 +2266,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2264 "Python/generated_cases.c.h" + #line 2270 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1641 "Python/bytecodes.c" + #line 1647 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2269 "Python/generated_cases.c.h" + #line 2275 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -2279,7 +2285,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1646 "Python/bytecodes.c" + #line 1652 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2292,7 +2298,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2296 "Python/generated_cases.c.h" + #line 2302 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2307,7 +2313,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1662 "Python/bytecodes.c" + #line 1668 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2320,7 +2326,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2324 "Python/generated_cases.c.h" + #line 2330 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2335,7 +2341,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1678 "Python/bytecodes.c" + #line 1684 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2362,7 +2368,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2366 "Python/generated_cases.c.h" + #line 2372 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2377,7 +2383,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1708 "Python/bytecodes.c" + #line 1714 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2387,7 +2393,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2391 "Python/generated_cases.c.h" + #line 2397 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2402,7 +2408,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1721 "Python/bytecodes.c" + #line 1727 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2414,7 +2420,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2418 "Python/generated_cases.c.h" + #line 2424 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2428,7 +2434,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 1736 "Python/bytecodes.c" + #line 1742 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2451,7 +2457,7 @@ new_frame->localsplus[0] = owner; JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); DISPATCH_INLINED(new_frame); - #line 2455 "Python/generated_cases.c.h" + #line 2461 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2459,7 +2465,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 1761 "Python/bytecodes.c" + #line 1767 "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); @@ -2484,7 +2490,7 @@ new_frame->localsplus[1] = Py_NewRef(name); JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); DISPATCH_INLINED(new_frame); - #line 2488 "Python/generated_cases.c.h" + #line 2494 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2492,7 +2498,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 1788 "Python/bytecodes.c" + #line 1794 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2510,7 +2516,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2514 "Python/generated_cases.c.h" + #line 2520 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2521,7 +2527,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 1808 "Python/bytecodes.c" + #line 1814 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2560,7 +2566,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2564 "Python/generated_cases.c.h" + #line 2570 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2571,7 +2577,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 1849 "Python/bytecodes.c" + #line 1855 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2581,7 +2587,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2585 "Python/generated_cases.c.h" + #line 2591 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2593,7 +2599,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1868 "Python/bytecodes.c" + #line 1874 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2606,12 +2612,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); - #line 2610 "Python/generated_cases.c.h" + #line 2616 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1881 "Python/bytecodes.c" + #line 1887 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2615 "Python/generated_cases.c.h" + #line 2621 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2622,7 +2628,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1885 "Python/bytecodes.c" + #line 1891 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2634,7 +2640,7 @@ _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2638 "Python/generated_cases.c.h" + #line 2644 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2645,7 +2651,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1900 "Python/bytecodes.c" + #line 1906 "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); @@ -2661,7 +2667,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2665 "Python/generated_cases.c.h" + #line 2671 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2672,7 +2678,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1919 "Python/bytecodes.c" + #line 1925 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2685,7 +2691,7 @@ assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2689 "Python/generated_cases.c.h" + #line 2695 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2696,14 +2702,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1934 "Python/bytecodes.c" + #line 1940 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 2702 "Python/generated_cases.c.h" + #line 2708 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1936 "Python/bytecodes.c" + #line 1942 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2707 "Python/generated_cases.c.h" + #line 2713 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2713,15 +2719,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1940 "Python/bytecodes.c" + #line 1946 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 2719 "Python/generated_cases.c.h" + #line 2725 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1942 "Python/bytecodes.c" + #line 1948 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = Py_NewRef((res^oparg) ? Py_True : Py_False); - #line 2725 "Python/generated_cases.c.h" + #line 2731 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2732,12 +2738,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 1947 "Python/bytecodes.c" + #line 1953 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 2738 "Python/generated_cases.c.h" + #line 2744 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1949 "Python/bytecodes.c" + #line 1955 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -2745,10 +2751,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 2749 "Python/generated_cases.c.h" + #line 2755 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1957 "Python/bytecodes.c" + #line 1963 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -2757,7 +2763,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 2761 "Python/generated_cases.c.h" + #line 2767 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -2767,21 +2773,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1968 "Python/bytecodes.c" + #line 1974 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 2774 "Python/generated_cases.c.h" + #line 2780 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1971 "Python/bytecodes.c" + #line 1977 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 2781 "Python/generated_cases.c.h" + #line 2787 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1976 "Python/bytecodes.c" + #line 1982 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2785 "Python/generated_cases.c.h" + #line 2791 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -2790,15 +2796,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 1980 "Python/bytecodes.c" + #line 1986 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 2797 "Python/generated_cases.c.h" + #line 2803 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 1983 "Python/bytecodes.c" + #line 1989 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2802 "Python/generated_cases.c.h" + #line 2808 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -2807,29 +2813,29 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 1987 "Python/bytecodes.c" + #line 1993 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 2815 "Python/generated_cases.c.h" + #line 2821 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 1993 "Python/bytecodes.c" + #line 1999 "Python/bytecodes.c" JUMPBY(oparg); - #line 2824 "Python/generated_cases.c.h" + #line 2830 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); - #line 1997 "Python/bytecodes.c" + #line 2003 "Python/bytecodes.c" assert(oparg < INSTR_OFFSET()); JUMPBY(-oparg); - #line 2833 "Python/generated_cases.c.h" + #line 2839 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } @@ -2837,7 +2843,7 @@ TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; - #line 2003 "Python/bytecodes.c" + #line 2009 "Python/bytecodes.c" if (Py_IsTrue(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2847,9 +2853,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2851 "Python/generated_cases.c.h" + #line 2857 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2013 "Python/bytecodes.c" + #line 2019 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -2857,14 +2863,14 @@ if (err < 0) goto pop_1_error; } } - #line 2861 "Python/generated_cases.c.h" + #line 2867 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2023 "Python/bytecodes.c" + #line 2029 "Python/bytecodes.c" if (Py_IsFalse(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2874,9 +2880,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2878 "Python/generated_cases.c.h" + #line 2884 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2033 "Python/bytecodes.c" + #line 2039 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -2884,67 +2890,67 @@ if (err < 0) goto pop_1_error; } } - #line 2888 "Python/generated_cases.c.h" + #line 2894 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2043 "Python/bytecodes.c" + #line 2049 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 2897 "Python/generated_cases.c.h" + #line 2903 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2045 "Python/bytecodes.c" + #line 2051 "Python/bytecodes.c" JUMPBY(oparg); } else { _Py_DECREF_NO_DEALLOC(value); } - #line 2905 "Python/generated_cases.c.h" + #line 2911 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2053 "Python/bytecodes.c" + #line 2059 "Python/bytecodes.c" if (Py_IsNone(value)) { _Py_DECREF_NO_DEALLOC(value); JUMPBY(oparg); } else { - #line 2918 "Python/generated_cases.c.h" + #line 2924 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2059 "Python/bytecodes.c" + #line 2065 "Python/bytecodes.c" } - #line 2922 "Python/generated_cases.c.h" + #line 2928 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2063 "Python/bytecodes.c" + #line 2069 "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. * (see bpo-30039). */ JUMPBY(-oparg); - #line 2935 "Python/generated_cases.c.h" + #line 2941 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2072 "Python/bytecodes.c" + #line 2078 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 2948 "Python/generated_cases.c.h" + #line 2954 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -2955,16 +2961,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2080 "Python/bytecodes.c" + #line 2086 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 2964 "Python/generated_cases.c.h" + #line 2970 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2085 "Python/bytecodes.c" + #line 2091 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -2972,7 +2978,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_NewRef(Py_None); // Failure! } - #line 2976 "Python/generated_cases.c.h" + #line 2982 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -2981,10 +2987,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2095 "Python/bytecodes.c" + #line 2101 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = Py_NewRef(match ? Py_True : Py_False); - #line 2988 "Python/generated_cases.c.h" + #line 2994 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -2994,10 +3000,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2101 "Python/bytecodes.c" + #line 2107 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = Py_NewRef(match ? Py_True : Py_False); - #line 3001 "Python/generated_cases.c.h" + #line 3007 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3008,11 +3014,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2107 "Python/bytecodes.c" + #line 2113 "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; - #line 3016 "Python/generated_cases.c.h" + #line 3022 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3021,14 +3027,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2113 "Python/bytecodes.c" + #line 2119 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3028 "Python/generated_cases.c.h" + #line 3034 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2116 "Python/bytecodes.c" + #line 2122 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3032 "Python/generated_cases.c.h" + #line 3038 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3036,7 +3042,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2120 "Python/bytecodes.c" + #line 2126 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3059,11 +3065,11 @@ if (iter == NULL) { goto error; } - #line 3063 "Python/generated_cases.c.h" + #line 3069 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2143 "Python/bytecodes.c" + #line 2149 "Python/bytecodes.c" } - #line 3067 "Python/generated_cases.c.h" + #line 3073 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -3074,7 +3080,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2162 "Python/bytecodes.c" + #line 2168 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3105,7 +3111,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3109 "Python/generated_cases.c.h" + #line 3115 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3113,7 +3119,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2195 "Python/bytecodes.c" + #line 2201 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3139,14 +3145,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3143 "Python/generated_cases.c.h" + #line 3149 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2223 "Python/bytecodes.c" + #line 2229 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3166,7 +3172,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3170 "Python/generated_cases.c.h" + #line 3176 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3176,7 +3182,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2245 "Python/bytecodes.c" + #line 2251 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3196,7 +3202,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3200 "Python/generated_cases.c.h" + #line 3206 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3206,7 +3212,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2267 "Python/bytecodes.c" + #line 2273 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3224,7 +3230,7 @@ if (next == NULL) { goto error; } - #line 3228 "Python/generated_cases.c.h" + #line 3234 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3233,7 +3239,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2287 "Python/bytecodes.c" + #line 2293 "Python/bytecodes.c" PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, FOR_ITER); @@ -3248,14 +3254,14 @@ assert(next_instr->op.code == END_FOR || next_instr->op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3252 "Python/generated_cases.c.h" + #line 3258 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2304 "Python/bytecodes.c" + #line 2310 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3278,16 +3284,16 @@ Py_DECREF(enter); goto error; } - #line 3282 "Python/generated_cases.c.h" + #line 3288 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2327 "Python/bytecodes.c" + #line 2333 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3291 "Python/generated_cases.c.h" + #line 3297 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3299,7 +3305,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2337 "Python/bytecodes.c" + #line 2343 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3325,16 +3331,16 @@ Py_DECREF(enter); goto error; } - #line 3329 "Python/generated_cases.c.h" + #line 3335 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2363 "Python/bytecodes.c" + #line 2369 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3338 "Python/generated_cases.c.h" + #line 3344 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3346,7 +3352,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2372 "Python/bytecodes.c" + #line 2378 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3367,7 +3373,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3371 "Python/generated_cases.c.h" + #line 3377 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3376,7 +3382,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2395 "Python/bytecodes.c" + #line 2401 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3386,7 +3392,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3390 "Python/generated_cases.c.h" + #line 3396 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3400,7 +3406,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 2407 "Python/bytecodes.c" + #line 2413 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3417,7 +3423,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3421 "Python/generated_cases.c.h" + #line 3427 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3431,7 +3437,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2426 "Python/bytecodes.c" + #line 2432 "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); @@ -3441,7 +3447,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3445 "Python/generated_cases.c.h" + #line 3451 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3455,7 +3461,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2438 "Python/bytecodes.c" + #line 2444 "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; @@ -3469,7 +3475,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3473 "Python/generated_cases.c.h" + #line 3479 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3478,16 +3484,16 @@ } TARGET(KW_NAMES) { - #line 2454 "Python/bytecodes.c" + #line 2460 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(frame->f_code->co_consts)); kwnames = GETITEM(frame->f_code->co_consts, oparg); - #line 3486 "Python/generated_cases.c.h" + #line 3492 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2460 "Python/bytecodes.c" + #line 2466 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3500,7 +3506,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3504 "Python/generated_cases.c.h" + #line 3510 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3510,7 +3516,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2505 "Python/bytecodes.c" + #line 2511 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3591,7 +3597,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3595 "Python/generated_cases.c.h" + #line 3601 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3603,7 +3609,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2592 "Python/bytecodes.c" + #line 2598 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3613,7 +3619,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3617 "Python/generated_cases.c.h" + #line 3623 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3622,7 +3628,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2604 "Python/bytecodes.c" + #line 2610 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3647,7 +3653,7 @@ STACK_SHRINK(oparg + 2); JUMPBY(INLINE_CACHE_ENTRIES_CALL); DISPATCH_INLINED(new_frame); - #line 3651 "Python/generated_cases.c.h" + #line 3657 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3655,7 +3661,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2631 "Python/bytecodes.c" + #line 2637 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3690,7 +3696,7 @@ STACK_SHRINK(oparg + 2); JUMPBY(INLINE_CACHE_ENTRIES_CALL); DISPATCH_INLINED(new_frame); - #line 3694 "Python/generated_cases.c.h" + #line 3700 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -3698,7 +3704,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2668 "Python/bytecodes.c" + #line 2674 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3708,7 +3714,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 3712 "Python/generated_cases.c.h" + #line 3718 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3721,7 +3727,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2680 "Python/bytecodes.c" + #line 2686 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3732,7 +3738,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3736 "Python/generated_cases.c.h" + #line 3742 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3746,7 +3752,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2694 "Python/bytecodes.c" + #line 2700 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3757,7 +3763,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3761 "Python/generated_cases.c.h" + #line 3767 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3771,7 +3777,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2708 "Python/bytecodes.c" + #line 2714 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3793,7 +3799,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3797 "Python/generated_cases.c.h" + #line 3803 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3807,7 +3813,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2733 "Python/bytecodes.c" + #line 2739 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3835,7 +3841,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3839 "Python/generated_cases.c.h" + #line 3845 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3849,7 +3855,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2764 "Python/bytecodes.c" + #line 2770 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3881,7 +3887,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 3885 "Python/generated_cases.c.h" + #line 3891 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3895,7 +3901,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2799 "Python/bytecodes.c" + #line 2805 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -3927,7 +3933,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3931 "Python/generated_cases.c.h" + #line 3937 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3941,7 +3947,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2834 "Python/bytecodes.c" + #line 2840 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -3966,7 +3972,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3970 "Python/generated_cases.c.h" + #line 3976 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3979,7 +3985,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2861 "Python/bytecodes.c" + #line 2867 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4006,7 +4012,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4010 "Python/generated_cases.c.h" + #line 4016 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4018,7 +4024,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2891 "Python/bytecodes.c" + #line 2897 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4036,14 +4042,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4040 "Python/generated_cases.c.h" + #line 4046 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2911 "Python/bytecodes.c" + #line 2917 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4074,7 +4080,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4078 "Python/generated_cases.c.h" + #line 4084 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4087,7 +4093,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2945 "Python/bytecodes.c" + #line 2951 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4116,7 +4122,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4120 "Python/generated_cases.c.h" + #line 4126 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4129,7 +4135,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2977 "Python/bytecodes.c" + #line 2983 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4158,7 +4164,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4162 "Python/generated_cases.c.h" + #line 4168 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4171,7 +4177,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3009 "Python/bytecodes.c" + #line 3015 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4199,7 +4205,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4203 "Python/generated_cases.c.h" + #line 4209 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4209,9 +4215,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3040 "Python/bytecodes.c" + #line 3046 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4215 "Python/generated_cases.c.h" + #line 4221 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4220,7 +4226,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3044 "Python/bytecodes.c" + #line 3050 "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)); @@ -4263,14 +4269,14 @@ else { result = PyObject_Call(func, callargs, kwargs); } - #line 4267 "Python/generated_cases.c.h" + #line 4273 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3087 "Python/bytecodes.c" + #line 3093 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4274 "Python/generated_cases.c.h" + #line 4280 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4285,7 +4291,7 @@ PyObject *kwdefaults = (oparg & 0x02) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0))] : NULL; PyObject *defaults = (oparg & 0x01) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x01) ? 1 : 0))] : NULL; PyObject *func; - #line 3097 "Python/bytecodes.c" + #line 3103 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4314,14 +4320,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4318 "Python/generated_cases.c.h" + #line 4324 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 0x01) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x08) ? 1 : 0)); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3128 "Python/bytecodes.c" + #line 3134 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4342,7 +4348,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4346 "Python/generated_cases.c.h" + #line 4352 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4350,15 +4356,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3151 "Python/bytecodes.c" + #line 3157 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4356 "Python/generated_cases.c.h" + #line 4362 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3153 "Python/bytecodes.c" + #line 3159 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4362 "Python/generated_cases.c.h" + #line 4368 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4369,7 +4375,7 @@ 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))]; PyObject *result; - #line 3157 "Python/bytecodes.c" + #line 3163 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4404,7 +4410,7 @@ 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 4408 "Python/generated_cases.c.h" + #line 4414 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4413,10 +4419,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3194 "Python/bytecodes.c" + #line 3200 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4420 "Python/generated_cases.c.h" + #line 4426 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4428,7 +4434,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3199 "Python/bytecodes.c" + #line 3205 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4443,12 +4449,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4447 "Python/generated_cases.c.h" + #line 4453 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3214 "Python/bytecodes.c" + #line 3220 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4452 "Python/generated_cases.c.h" + #line 4458 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4458,16 +4464,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3219 "Python/bytecodes.c" + #line 3225 "Python/bytecodes.c" assert(oparg >= 2); - #line 4464 "Python/generated_cases.c.h" + #line 4470 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_LINE) { - #line 3223 "Python/bytecodes.c" + #line 3229 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _PyFrame_SetStackPointer(frame, stack_pointer); int original_opcode = _Py_call_instrumentation_line( @@ -4487,11 +4493,11 @@ } opcode = original_opcode; DISPATCH_GOTO(); - #line 4491 "Python/generated_cases.c.h" + #line 4497 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3245 "Python/bytecodes.c" + #line 3251 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4503,26 +4509,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4507 "Python/generated_cases.c.h" + #line 4513 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3259 "Python/bytecodes.c" + #line 3265 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4513 "Python/generated_cases.c.h" + #line 4519 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3263 "Python/bytecodes.c" + #line 3269 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr-oparg, PY_MONITORING_EVENT_JUMP); - #line 4520 "Python/generated_cases.c.h" + #line 4526 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3268 "Python/bytecodes.c" + #line 3274 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4531,12 +4537,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4535 "Python/generated_cases.c.h" + #line 4541 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3279 "Python/bytecodes.c" + #line 3285 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4545,12 +4551,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4549 "Python/generated_cases.c.h" + #line 4555 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3290 "Python/bytecodes.c" + #line 3296 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4563,12 +4569,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4567 "Python/generated_cases.c.h" + #line 4573 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3305 "Python/bytecodes.c" + #line 3311 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4581,30 +4587,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4585 "Python/generated_cases.c.h" + #line 4591 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3320 "Python/bytecodes.c" + #line 3326 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4596 "Python/generated_cases.c.h" + #line 4602 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3328 "Python/bytecodes.c" + #line 3334 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4603 "Python/generated_cases.c.h" + #line 4609 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3333 "Python/bytecodes.c" + #line 3339 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4610 "Python/generated_cases.c.h" + #line 4616 "Python/generated_cases.c.h" } diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h index 841d1ab95a746e..fb370ef923dd92 100644 --- a/Python/opcode_metadata.h +++ b/Python/opcode_metadata.h @@ -205,7 +205,7 @@ _PyOpcode_num_popped(int opcode, int oparg, bool jump) { return 1; case MAP_ADD: return 2; - case LOAD_ZERO_SUPER_ATTR: + case LOAD_SUPER_ATTR: return 3; case LOAD_ATTR: return 1; @@ -591,7 +591,7 @@ _PyOpcode_num_pushed(int opcode, int oparg, bool jump) { return 0; case MAP_ADD: return 0; - case LOAD_ZERO_SUPER_ATTR: + case LOAD_SUPER_ATTR: return ((oparg & 1) ? 1 : 0) + 1; case LOAD_ATTR: return ((oparg & 1) ? 1 : 0) + 1; @@ -883,7 +883,7 @@ const struct opcode_metadata _PyOpcode_opcode_metadata[256] = { [DICT_UPDATE] = { true, INSTR_FMT_IB }, [DICT_MERGE] = { true, INSTR_FMT_IB }, [MAP_ADD] = { true, INSTR_FMT_IB }, - [LOAD_ZERO_SUPER_ATTR] = { true, INSTR_FMT_IB }, + [LOAD_SUPER_ATTR] = { true, INSTR_FMT_IB }, [LOAD_ATTR] = { true, INSTR_FMT_IBC00000000 }, [LOAD_ATTR_INSTANCE_VALUE] = { true, INSTR_FMT_IBC00000000 }, [LOAD_ATTR_MODULE] = { true, INSTR_FMT_IBC00000000 }, diff --git a/Python/opcode_targets.h b/Python/opcode_targets.h index 10d191747c228e..01091829271bc5 100644 --- a/Python/opcode_targets.h +++ b/Python/opcode_targets.h @@ -140,7 +140,7 @@ static void *opcode_targets[256] = { &&TARGET_STORE_DEREF, &&TARGET_DELETE_DEREF, &&TARGET_JUMP_BACKWARD, - &&TARGET_LOAD_ZERO_SUPER_ATTR, + &&TARGET_LOAD_SUPER_ATTR, &&TARGET_CALL_FUNCTION_EX, &&TARGET_STORE_FAST__STORE_FAST, &&TARGET_EXTENDED_ARG, From 626999d61d3f8f4802c2a53776924e1fd5986add Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 12 Apr 2023 23:00:59 -0700 Subject: [PATCH 06/16] fix incompatible assignment --- Objects/typeobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index f6f30032d8291f..6152814bc1cbfc 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -9433,7 +9433,7 @@ do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj, skip: if (su == NULL) { - su = PyObject_Vectorcall((PyObject *)&PySuper_Type, NULL, 0, NULL); + su = (superobject *)PyObject_Vectorcall((PyObject *)&PySuper_Type, NULL, 0, NULL); if (su == NULL) { return NULL; } From 92c943b57926a59df2af8833c8c63de5ab904c26 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Thu, 13 Apr 2023 16:12:21 -0700 Subject: [PATCH 07/16] fix bad first arg --- Lib/test/test_super.py | 8 + Python/bytecodes.c | 3 +- Python/generated_cases.c.h | 449 ++++++++++++++++++------------------- 3 files changed, 233 insertions(+), 227 deletions(-) diff --git a/Lib/test/test_super.py b/Lib/test/test_super.py index d4f146aed5aa85..2cdfd342f320f1 100644 --- a/Lib/test/test_super.py +++ b/Lib/test/test_super.py @@ -385,6 +385,14 @@ def method(self): with self.assertRaisesRegex(AttributeError, "'super' object has no attribute 'msg'"): C().method() + def test_bad_first_arg(self): + class C: + def method(self): + return super(1, self).method() + + with self.assertRaisesRegex(TypeError, "argument 1 must be a type"): + C().method() + if __name__ == "__main__": unittest.main() diff --git a/Python/bytecodes.c b/Python/bytecodes.c index d250dba9ec71df..2bae2dac44957e 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -1556,10 +1556,9 @@ dummy_func( inst(LOAD_SUPER_ATTR, (global_super, class, self -- res2 if (oparg & 1), res)) { PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); - if (global_super == (PyObject *)&PySuper_Type) { + if (global_super == (PyObject *)&PySuper_Type && PyType_Check(class)) { int meth_found = 0; Py_DECREF(global_super); - assert(PyType_Check(class)); res = _PySuper_Lookup((PyTypeObject *)class, self, name, oparg & 1 ? &meth_found : NULL); Py_DECREF(class); if (res == NULL) { diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 6686d0a89e3076..396bffcdd74158 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -2175,10 +2175,9 @@ PyObject *res; #line 1558 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); - if (global_super == (PyObject *)&PySuper_Type) { + if (global_super == (PyObject *)&PySuper_Type && PyType_Check(class)) { int meth_found = 0; Py_DECREF(global_super); - assert(PyType_Check(class)); res = _PySuper_Lookup((PyTypeObject *)class, self, name, oparg & 1 ? &meth_found : NULL); Py_DECREF(class); if (res == NULL) { @@ -2200,17 +2199,17 @@ PyObject *stack[] = {class, self}; super = PyObject_Vectorcall(global_super, stack, 2, NULL); } - #line 2204 "Python/generated_cases.c.h" + #line 2203 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1585 "Python/bytecodes.c" + #line 1584 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); if (res == NULL) goto pop_3_error; } - #line 2214 "Python/generated_cases.c.h" + #line 2213 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2224,7 +2223,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1607 "Python/bytecodes.c" + #line 1606 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2258,9 +2257,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2262 "Python/generated_cases.c.h" + #line 2261 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1641 "Python/bytecodes.c" + #line 1640 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2269,12 +2268,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2273 "Python/generated_cases.c.h" + #line 2272 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1650 "Python/bytecodes.c" + #line 1649 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2278 "Python/generated_cases.c.h" + #line 2277 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -2288,7 +2287,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1655 "Python/bytecodes.c" + #line 1654 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2301,7 +2300,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2305 "Python/generated_cases.c.h" + #line 2304 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2316,7 +2315,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1671 "Python/bytecodes.c" + #line 1670 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2329,7 +2328,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2333 "Python/generated_cases.c.h" + #line 2332 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2344,7 +2343,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1687 "Python/bytecodes.c" + #line 1686 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2371,7 +2370,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2375 "Python/generated_cases.c.h" + #line 2374 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2386,7 +2385,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1717 "Python/bytecodes.c" + #line 1716 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2396,7 +2395,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2400 "Python/generated_cases.c.h" + #line 2399 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2411,7 +2410,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1730 "Python/bytecodes.c" + #line 1729 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2423,7 +2422,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2427 "Python/generated_cases.c.h" + #line 2426 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2437,7 +2436,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 1745 "Python/bytecodes.c" + #line 1744 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2461,7 +2460,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2465 "Python/generated_cases.c.h" + #line 2464 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2469,7 +2468,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 1771 "Python/bytecodes.c" + #line 1770 "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); @@ -2495,7 +2494,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2499 "Python/generated_cases.c.h" + #line 2498 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2503,7 +2502,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 1799 "Python/bytecodes.c" + #line 1798 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2521,7 +2520,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2525 "Python/generated_cases.c.h" + #line 2524 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2532,7 +2531,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 1819 "Python/bytecodes.c" + #line 1818 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2571,7 +2570,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2575 "Python/generated_cases.c.h" + #line 2574 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2582,7 +2581,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 1860 "Python/bytecodes.c" + #line 1859 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2592,7 +2591,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2596 "Python/generated_cases.c.h" + #line 2595 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2604,7 +2603,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1879 "Python/bytecodes.c" + #line 1878 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2617,12 +2616,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); - #line 2621 "Python/generated_cases.c.h" + #line 2620 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1892 "Python/bytecodes.c" + #line 1891 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2626 "Python/generated_cases.c.h" + #line 2625 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2633,7 +2632,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1896 "Python/bytecodes.c" + #line 1895 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2645,7 +2644,7 @@ _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2649 "Python/generated_cases.c.h" + #line 2648 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2656,7 +2655,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1911 "Python/bytecodes.c" + #line 1910 "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); @@ -2672,7 +2671,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2676 "Python/generated_cases.c.h" + #line 2675 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2683,7 +2682,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1930 "Python/bytecodes.c" + #line 1929 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2696,7 +2695,7 @@ assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2700 "Python/generated_cases.c.h" + #line 2699 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2707,14 +2706,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1945 "Python/bytecodes.c" + #line 1944 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 2713 "Python/generated_cases.c.h" + #line 2712 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1947 "Python/bytecodes.c" + #line 1946 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2718 "Python/generated_cases.c.h" + #line 2717 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2724,15 +2723,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1951 "Python/bytecodes.c" + #line 1950 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 2730 "Python/generated_cases.c.h" + #line 2729 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1953 "Python/bytecodes.c" + #line 1952 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = Py_NewRef((res^oparg) ? Py_True : Py_False); - #line 2736 "Python/generated_cases.c.h" + #line 2735 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2743,12 +2742,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 1958 "Python/bytecodes.c" + #line 1957 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 2749 "Python/generated_cases.c.h" + #line 2748 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1960 "Python/bytecodes.c" + #line 1959 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -2756,10 +2755,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 2760 "Python/generated_cases.c.h" + #line 2759 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1968 "Python/bytecodes.c" + #line 1967 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -2768,7 +2767,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 2772 "Python/generated_cases.c.h" + #line 2771 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -2778,21 +2777,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1979 "Python/bytecodes.c" + #line 1978 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 2785 "Python/generated_cases.c.h" + #line 2784 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1982 "Python/bytecodes.c" + #line 1981 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 2792 "Python/generated_cases.c.h" + #line 2791 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1987 "Python/bytecodes.c" + #line 1986 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2796 "Python/generated_cases.c.h" + #line 2795 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -2801,15 +2800,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 1991 "Python/bytecodes.c" + #line 1990 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 2808 "Python/generated_cases.c.h" + #line 2807 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 1994 "Python/bytecodes.c" + #line 1993 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2813 "Python/generated_cases.c.h" + #line 2812 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -2818,29 +2817,29 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 1998 "Python/bytecodes.c" + #line 1997 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 2826 "Python/generated_cases.c.h" + #line 2825 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 2004 "Python/bytecodes.c" + #line 2003 "Python/bytecodes.c" JUMPBY(oparg); - #line 2835 "Python/generated_cases.c.h" + #line 2834 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); - #line 2008 "Python/bytecodes.c" + #line 2007 "Python/bytecodes.c" assert(oparg < INSTR_OFFSET()); JUMPBY(-oparg); - #line 2844 "Python/generated_cases.c.h" + #line 2843 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } @@ -2848,7 +2847,7 @@ TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; - #line 2014 "Python/bytecodes.c" + #line 2013 "Python/bytecodes.c" if (Py_IsTrue(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2858,9 +2857,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2862 "Python/generated_cases.c.h" + #line 2861 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2024 "Python/bytecodes.c" + #line 2023 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -2868,14 +2867,14 @@ if (err < 0) goto pop_1_error; } } - #line 2872 "Python/generated_cases.c.h" + #line 2871 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2034 "Python/bytecodes.c" + #line 2033 "Python/bytecodes.c" if (Py_IsFalse(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2885,9 +2884,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2889 "Python/generated_cases.c.h" + #line 2888 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2044 "Python/bytecodes.c" + #line 2043 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -2895,67 +2894,67 @@ if (err < 0) goto pop_1_error; } } - #line 2899 "Python/generated_cases.c.h" + #line 2898 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2054 "Python/bytecodes.c" + #line 2053 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 2908 "Python/generated_cases.c.h" + #line 2907 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2056 "Python/bytecodes.c" + #line 2055 "Python/bytecodes.c" JUMPBY(oparg); } else { _Py_DECREF_NO_DEALLOC(value); } - #line 2916 "Python/generated_cases.c.h" + #line 2915 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2064 "Python/bytecodes.c" + #line 2063 "Python/bytecodes.c" if (Py_IsNone(value)) { _Py_DECREF_NO_DEALLOC(value); JUMPBY(oparg); } else { - #line 2929 "Python/generated_cases.c.h" + #line 2928 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2070 "Python/bytecodes.c" + #line 2069 "Python/bytecodes.c" } - #line 2933 "Python/generated_cases.c.h" + #line 2932 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2074 "Python/bytecodes.c" + #line 2073 "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. * (see bpo-30039). */ JUMPBY(-oparg); - #line 2946 "Python/generated_cases.c.h" + #line 2945 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2083 "Python/bytecodes.c" + #line 2082 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 2959 "Python/generated_cases.c.h" + #line 2958 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -2966,16 +2965,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2091 "Python/bytecodes.c" + #line 2090 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 2975 "Python/generated_cases.c.h" + #line 2974 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2096 "Python/bytecodes.c" + #line 2095 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -2983,7 +2982,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_NewRef(Py_None); // Failure! } - #line 2987 "Python/generated_cases.c.h" + #line 2986 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -2992,10 +2991,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2106 "Python/bytecodes.c" + #line 2105 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = Py_NewRef(match ? Py_True : Py_False); - #line 2999 "Python/generated_cases.c.h" + #line 2998 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3005,10 +3004,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2112 "Python/bytecodes.c" + #line 2111 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = Py_NewRef(match ? Py_True : Py_False); - #line 3012 "Python/generated_cases.c.h" + #line 3011 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3019,11 +3018,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2118 "Python/bytecodes.c" + #line 2117 "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; - #line 3027 "Python/generated_cases.c.h" + #line 3026 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3032,14 +3031,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2124 "Python/bytecodes.c" + #line 2123 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3039 "Python/generated_cases.c.h" + #line 3038 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2127 "Python/bytecodes.c" + #line 2126 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3043 "Python/generated_cases.c.h" + #line 3042 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3047,7 +3046,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2131 "Python/bytecodes.c" + #line 2130 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3070,11 +3069,11 @@ if (iter == NULL) { goto error; } - #line 3074 "Python/generated_cases.c.h" + #line 3073 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2154 "Python/bytecodes.c" + #line 2153 "Python/bytecodes.c" } - #line 3078 "Python/generated_cases.c.h" + #line 3077 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -3085,7 +3084,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2173 "Python/bytecodes.c" + #line 2172 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3116,7 +3115,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3120 "Python/generated_cases.c.h" + #line 3119 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3124,7 +3123,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2206 "Python/bytecodes.c" + #line 2205 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3150,14 +3149,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3154 "Python/generated_cases.c.h" + #line 3153 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2234 "Python/bytecodes.c" + #line 2233 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3177,7 +3176,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3181 "Python/generated_cases.c.h" + #line 3180 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3187,7 +3186,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2256 "Python/bytecodes.c" + #line 2255 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3207,7 +3206,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3211 "Python/generated_cases.c.h" + #line 3210 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3217,7 +3216,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2278 "Python/bytecodes.c" + #line 2277 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3235,7 +3234,7 @@ if (next == NULL) { goto error; } - #line 3239 "Python/generated_cases.c.h" + #line 3238 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3244,7 +3243,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2298 "Python/bytecodes.c" + #line 2297 "Python/bytecodes.c" PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, FOR_ITER); @@ -3259,14 +3258,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3263 "Python/generated_cases.c.h" + #line 3262 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2315 "Python/bytecodes.c" + #line 2314 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3289,16 +3288,16 @@ Py_DECREF(enter); goto error; } - #line 3293 "Python/generated_cases.c.h" + #line 3292 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2338 "Python/bytecodes.c" + #line 2337 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3302 "Python/generated_cases.c.h" + #line 3301 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3310,7 +3309,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2348 "Python/bytecodes.c" + #line 2347 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3336,16 +3335,16 @@ Py_DECREF(enter); goto error; } - #line 3340 "Python/generated_cases.c.h" + #line 3339 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2374 "Python/bytecodes.c" + #line 2373 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3349 "Python/generated_cases.c.h" + #line 3348 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3357,7 +3356,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2383 "Python/bytecodes.c" + #line 2382 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3378,7 +3377,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3382 "Python/generated_cases.c.h" + #line 3381 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3387,7 +3386,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2406 "Python/bytecodes.c" + #line 2405 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3397,7 +3396,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3401 "Python/generated_cases.c.h" + #line 3400 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3411,7 +3410,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 2418 "Python/bytecodes.c" + #line 2417 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3428,7 +3427,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3432 "Python/generated_cases.c.h" + #line 3431 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3442,7 +3441,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2437 "Python/bytecodes.c" + #line 2436 "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); @@ -3452,7 +3451,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3456 "Python/generated_cases.c.h" + #line 3455 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3466,7 +3465,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2449 "Python/bytecodes.c" + #line 2448 "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; @@ -3480,7 +3479,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3484 "Python/generated_cases.c.h" + #line 3483 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3489,16 +3488,16 @@ } TARGET(KW_NAMES) { - #line 2465 "Python/bytecodes.c" + #line 2464 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(frame->f_code->co_consts)); kwnames = GETITEM(frame->f_code->co_consts, oparg); - #line 3497 "Python/generated_cases.c.h" + #line 3496 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2471 "Python/bytecodes.c" + #line 2470 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3511,7 +3510,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3515 "Python/generated_cases.c.h" + #line 3514 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3521,7 +3520,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2516 "Python/bytecodes.c" + #line 2515 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3603,7 +3602,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3607 "Python/generated_cases.c.h" + #line 3606 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3615,7 +3614,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2604 "Python/bytecodes.c" + #line 2603 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3625,7 +3624,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3629 "Python/generated_cases.c.h" + #line 3628 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3634,7 +3633,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2616 "Python/bytecodes.c" + #line 2615 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3660,7 +3659,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3664 "Python/generated_cases.c.h" + #line 3663 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3668,7 +3667,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2644 "Python/bytecodes.c" + #line 2643 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3704,7 +3703,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3708 "Python/generated_cases.c.h" + #line 3707 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -3712,7 +3711,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2682 "Python/bytecodes.c" + #line 2681 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3722,7 +3721,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 3726 "Python/generated_cases.c.h" + #line 3725 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3735,7 +3734,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2694 "Python/bytecodes.c" + #line 2693 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3746,7 +3745,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3750 "Python/generated_cases.c.h" + #line 3749 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3760,7 +3759,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2708 "Python/bytecodes.c" + #line 2707 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3771,7 +3770,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3775 "Python/generated_cases.c.h" + #line 3774 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3785,7 +3784,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2722 "Python/bytecodes.c" + #line 2721 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3807,7 +3806,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3811 "Python/generated_cases.c.h" + #line 3810 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3821,7 +3820,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2747 "Python/bytecodes.c" + #line 2746 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3849,7 +3848,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3853 "Python/generated_cases.c.h" + #line 3852 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3863,7 +3862,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2778 "Python/bytecodes.c" + #line 2777 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3895,7 +3894,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 3899 "Python/generated_cases.c.h" + #line 3898 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3909,7 +3908,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2813 "Python/bytecodes.c" + #line 2812 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -3941,7 +3940,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3945 "Python/generated_cases.c.h" + #line 3944 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3955,7 +3954,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2848 "Python/bytecodes.c" + #line 2847 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -3980,7 +3979,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3984 "Python/generated_cases.c.h" + #line 3983 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3993,7 +3992,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2875 "Python/bytecodes.c" + #line 2874 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4020,7 +4019,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4024 "Python/generated_cases.c.h" + #line 4023 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4032,7 +4031,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2905 "Python/bytecodes.c" + #line 2904 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4050,14 +4049,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4054 "Python/generated_cases.c.h" + #line 4053 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2925 "Python/bytecodes.c" + #line 2924 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4088,7 +4087,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4092 "Python/generated_cases.c.h" + #line 4091 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4101,7 +4100,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2959 "Python/bytecodes.c" + #line 2958 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4130,7 +4129,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4134 "Python/generated_cases.c.h" + #line 4133 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4143,7 +4142,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2991 "Python/bytecodes.c" + #line 2990 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4172,7 +4171,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4176 "Python/generated_cases.c.h" + #line 4175 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4185,7 +4184,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3023 "Python/bytecodes.c" + #line 3022 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4213,7 +4212,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4217 "Python/generated_cases.c.h" + #line 4216 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4223,9 +4222,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3054 "Python/bytecodes.c" + #line 3053 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4229 "Python/generated_cases.c.h" + #line 4228 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4234,7 +4233,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3058 "Python/bytecodes.c" + #line 3057 "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)); @@ -4277,14 +4276,14 @@ else { result = PyObject_Call(func, callargs, kwargs); } - #line 4281 "Python/generated_cases.c.h" + #line 4280 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3101 "Python/bytecodes.c" + #line 3100 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4288 "Python/generated_cases.c.h" + #line 4287 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4299,7 +4298,7 @@ PyObject *kwdefaults = (oparg & 0x02) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0))] : NULL; PyObject *defaults = (oparg & 0x01) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x01) ? 1 : 0))] : NULL; PyObject *func; - #line 3111 "Python/bytecodes.c" + #line 3110 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4328,14 +4327,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4332 "Python/generated_cases.c.h" + #line 4331 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 0x01) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x08) ? 1 : 0)); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3142 "Python/bytecodes.c" + #line 3141 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4356,7 +4355,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4360 "Python/generated_cases.c.h" + #line 4359 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4364,15 +4363,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3165 "Python/bytecodes.c" + #line 3164 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4370 "Python/generated_cases.c.h" + #line 4369 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3167 "Python/bytecodes.c" + #line 3166 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4376 "Python/generated_cases.c.h" + #line 4375 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4383,7 +4382,7 @@ 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))]; PyObject *result; - #line 3171 "Python/bytecodes.c" + #line 3170 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4418,7 +4417,7 @@ 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 4422 "Python/generated_cases.c.h" + #line 4421 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4427,10 +4426,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3208 "Python/bytecodes.c" + #line 3207 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4434 "Python/generated_cases.c.h" + #line 4433 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4442,7 +4441,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3213 "Python/bytecodes.c" + #line 3212 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4457,12 +4456,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4461 "Python/generated_cases.c.h" + #line 4460 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3228 "Python/bytecodes.c" + #line 3227 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4466 "Python/generated_cases.c.h" + #line 4465 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4472,16 +4471,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3233 "Python/bytecodes.c" + #line 3232 "Python/bytecodes.c" assert(oparg >= 2); - #line 4478 "Python/generated_cases.c.h" + #line 4477 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_LINE) { - #line 3237 "Python/bytecodes.c" + #line 3236 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _PyFrame_SetStackPointer(frame, stack_pointer); int original_opcode = _Py_call_instrumentation_line( @@ -4501,11 +4500,11 @@ } opcode = original_opcode; DISPATCH_GOTO(); - #line 4505 "Python/generated_cases.c.h" + #line 4504 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3259 "Python/bytecodes.c" + #line 3258 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4517,26 +4516,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4521 "Python/generated_cases.c.h" + #line 4520 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3273 "Python/bytecodes.c" + #line 3272 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4527 "Python/generated_cases.c.h" + #line 4526 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3277 "Python/bytecodes.c" + #line 3276 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr-oparg, PY_MONITORING_EVENT_JUMP); - #line 4534 "Python/generated_cases.c.h" + #line 4533 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3282 "Python/bytecodes.c" + #line 3281 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4545,12 +4544,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4549 "Python/generated_cases.c.h" + #line 4548 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3293 "Python/bytecodes.c" + #line 3292 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4559,12 +4558,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4563 "Python/generated_cases.c.h" + #line 4562 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3304 "Python/bytecodes.c" + #line 3303 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4577,12 +4576,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4581 "Python/generated_cases.c.h" + #line 4580 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3319 "Python/bytecodes.c" + #line 3318 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4595,30 +4594,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4599 "Python/generated_cases.c.h" + #line 4598 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3334 "Python/bytecodes.c" + #line 3333 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4610 "Python/generated_cases.c.h" + #line 4609 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3342 "Python/bytecodes.c" + #line 3341 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4617 "Python/generated_cases.c.h" + #line 4616 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3347 "Python/bytecodes.c" + #line 3346 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4624 "Python/generated_cases.c.h" + #line 4623 "Python/generated_cases.c.h" } From 775ed0feeac0a004cb236bc7ae68868e8bc270e3 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Fri, 14 Apr 2023 08:35:55 -0600 Subject: [PATCH 08/16] Apply suggestions from code review Co-authored-by: Dong-hee Na --- Objects/typeobject.c | 5 +++-- Python/bytecodes.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 6152814bc1cbfc..c52fee8cc165c3 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -9406,7 +9406,8 @@ do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj, Py_INCREF(res); if (meth_found && _PyType_HasFeature(Py_TYPE(res), Py_TPFLAGS_METHOD_DESCRIPTOR)) { *meth_found = 1; - } else { + } + else { descrgetfunc f = Py_TYPE(res)->tp_descr_get; if (f != NULL) { PyObject *res2; @@ -9433,7 +9434,7 @@ do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj, skip: if (su == NULL) { - su = (superobject *)PyObject_Vectorcall((PyObject *)&PySuper_Type, NULL, 0, NULL); + su = (superobject *)PyObject_CallNoArgs((PyObject *)&PySuper_Type); if (su == NULL) { return NULL; } diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 2bae2dac44957e..843ccd2771fc92 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -1575,7 +1575,7 @@ dummy_func( } else { PyObject *super; if (oparg & 2) { - super = PyObject_Vectorcall(global_super, NULL, 0, NULL); + super = PyObject_CallNoArgs(global_super); } else { PyObject *stack[] = {class, self}; super = PyObject_Vectorcall(global_super, stack, 2, NULL); From 2077f1a676e1e8b580c715f70451e91b9db72f48 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Fri, 14 Apr 2023 07:39:35 -0700 Subject: [PATCH 09/16] don't unnecessarily re-find args in error case --- Objects/typeobject.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index c52fee8cc165c3..f6daea8fa2d029 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -9434,7 +9434,8 @@ do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj, skip: if (su == NULL) { - su = (superobject *)PyObject_CallNoArgs((PyObject *)&PySuper_Type); + PyObject *args[] = {su_type, su_obj}; + su = (superobject *)PyObject_Vectorcall((PyObject *)&PySuper_Type, args, 2, NULL); if (su == NULL) { return NULL; } From 4759ad96a13657d753c2ca879a663b6f5d6a0535 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Fri, 14 Apr 2023 07:47:02 -0700 Subject: [PATCH 10/16] update generated cases --- Python/generated_cases.c.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 396bffcdd74158..8d4f1df614798f 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -2194,7 +2194,7 @@ } else { PyObject *super; if (oparg & 2) { - super = PyObject_Vectorcall(global_super, NULL, 0, NULL); + super = PyObject_CallNoArgs(global_super); } else { PyObject *stack[] = {class, self}; super = PyObject_Vectorcall(global_super, stack, 2, NULL); From 94399c22ee8629b73ae14bdef564917d97d0e1e4 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Fri, 14 Apr 2023 11:40:52 -0700 Subject: [PATCH 11/16] fix incompatible types --- Objects/typeobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index f6daea8fa2d029..403b09c39eb963 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -9434,7 +9434,7 @@ do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj, skip: if (su == NULL) { - PyObject *args[] = {su_type, su_obj}; + PyObject *args[] = {(PyObject *)su_type, su_obj}; su = (superobject *)PyObject_Vectorcall((PyObject *)&PySuper_Type, args, 2, NULL); if (su == NULL) { return NULL; From 82945b28261c6e7ce9cf703ba67271f73d88b6a7 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Mon, 17 Apr 2023 07:02:21 -0700 Subject: [PATCH 12/16] review comments --- .../2023-04-12-20-22-03.gh-issue-87729.99A7UO.rst | 2 +- Python/bytecodes.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-22-03.gh-issue-87729.99A7UO.rst b/Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-22-03.gh-issue-87729.99A7UO.rst index 9b09190c96e449..e875b2ae7ac990 100644 --- a/Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-22-03.gh-issue-87729.99A7UO.rst +++ b/Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-22-03.gh-issue-87729.99A7UO.rst @@ -1 +1 @@ -Speed up ``super().meth()`` calls. +Add :opcode:`LOAD_SUPER_ATTR` to speed up ``super().meth()`` and ``super().attr`` calls. diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 843ccd2771fc92..0ad9f326cec8a6 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -1565,6 +1565,7 @@ dummy_func( Py_DECREF(self); ERROR_IF(true, error); } + // Works with CALL, pushes two values: either `meth | self` or `NULL | meth`. if (meth_found) { res2 = res; res = self; // transfer ownership From 3a3cb749f28fdb0aef89dbc5b2b535b0b1e3b0e6 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Mon, 17 Apr 2023 07:45:53 -0700 Subject: [PATCH 13/16] update generated cases with new comment --- Python/generated_cases.c.h | 447 +++++++++++++++++++------------------ 1 file changed, 224 insertions(+), 223 deletions(-) diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 8d4f1df614798f..0cd7137669012b 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -2184,6 +2184,7 @@ Py_DECREF(self); if (true) goto pop_3_error; } + // Works with CALL, pushes two values: either `meth | self` or `NULL | meth`. if (meth_found) { res2 = res; res = self; // transfer ownership @@ -2199,17 +2200,17 @@ PyObject *stack[] = {class, self}; super = PyObject_Vectorcall(global_super, stack, 2, NULL); } - #line 2203 "Python/generated_cases.c.h" + #line 2204 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1584 "Python/bytecodes.c" + #line 1585 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); if (res == NULL) goto pop_3_error; } - #line 2213 "Python/generated_cases.c.h" + #line 2214 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2223,7 +2224,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1606 "Python/bytecodes.c" + #line 1607 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2257,9 +2258,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2261 "Python/generated_cases.c.h" + #line 2262 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1640 "Python/bytecodes.c" + #line 1641 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2268,12 +2269,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2272 "Python/generated_cases.c.h" + #line 2273 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1649 "Python/bytecodes.c" + #line 1650 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2277 "Python/generated_cases.c.h" + #line 2278 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -2287,7 +2288,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1654 "Python/bytecodes.c" + #line 1655 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2300,7 +2301,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2304 "Python/generated_cases.c.h" + #line 2305 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2315,7 +2316,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1670 "Python/bytecodes.c" + #line 1671 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2328,7 +2329,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2332 "Python/generated_cases.c.h" + #line 2333 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2343,7 +2344,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1686 "Python/bytecodes.c" + #line 1687 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2370,7 +2371,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2374 "Python/generated_cases.c.h" + #line 2375 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2385,7 +2386,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1716 "Python/bytecodes.c" + #line 1717 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2395,7 +2396,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2399 "Python/generated_cases.c.h" + #line 2400 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2410,7 +2411,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1729 "Python/bytecodes.c" + #line 1730 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2422,7 +2423,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2426 "Python/generated_cases.c.h" + #line 2427 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2436,7 +2437,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 1744 "Python/bytecodes.c" + #line 1745 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2460,7 +2461,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2464 "Python/generated_cases.c.h" + #line 2465 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2468,7 +2469,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 1770 "Python/bytecodes.c" + #line 1771 "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); @@ -2494,7 +2495,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2498 "Python/generated_cases.c.h" + #line 2499 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2502,7 +2503,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 1798 "Python/bytecodes.c" + #line 1799 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2520,7 +2521,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2524 "Python/generated_cases.c.h" + #line 2525 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2531,7 +2532,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 1818 "Python/bytecodes.c" + #line 1819 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2570,7 +2571,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2574 "Python/generated_cases.c.h" + #line 2575 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2581,7 +2582,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 1859 "Python/bytecodes.c" + #line 1860 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2591,7 +2592,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2595 "Python/generated_cases.c.h" + #line 2596 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2603,7 +2604,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1878 "Python/bytecodes.c" + #line 1879 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2616,12 +2617,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); - #line 2620 "Python/generated_cases.c.h" + #line 2621 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1891 "Python/bytecodes.c" + #line 1892 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2625 "Python/generated_cases.c.h" + #line 2626 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2632,7 +2633,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1895 "Python/bytecodes.c" + #line 1896 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2644,7 +2645,7 @@ _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2648 "Python/generated_cases.c.h" + #line 2649 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2655,7 +2656,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1910 "Python/bytecodes.c" + #line 1911 "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); @@ -2671,7 +2672,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2675 "Python/generated_cases.c.h" + #line 2676 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2682,7 +2683,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1929 "Python/bytecodes.c" + #line 1930 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2695,7 +2696,7 @@ assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2699 "Python/generated_cases.c.h" + #line 2700 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2706,14 +2707,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1944 "Python/bytecodes.c" + #line 1945 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 2712 "Python/generated_cases.c.h" + #line 2713 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1946 "Python/bytecodes.c" + #line 1947 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2717 "Python/generated_cases.c.h" + #line 2718 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2723,15 +2724,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1950 "Python/bytecodes.c" + #line 1951 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 2729 "Python/generated_cases.c.h" + #line 2730 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1952 "Python/bytecodes.c" + #line 1953 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = Py_NewRef((res^oparg) ? Py_True : Py_False); - #line 2735 "Python/generated_cases.c.h" + #line 2736 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2742,12 +2743,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 1957 "Python/bytecodes.c" + #line 1958 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 2748 "Python/generated_cases.c.h" + #line 2749 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1959 "Python/bytecodes.c" + #line 1960 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -2755,10 +2756,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 2759 "Python/generated_cases.c.h" + #line 2760 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1967 "Python/bytecodes.c" + #line 1968 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -2767,7 +2768,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 2771 "Python/generated_cases.c.h" + #line 2772 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -2777,21 +2778,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1978 "Python/bytecodes.c" + #line 1979 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 2784 "Python/generated_cases.c.h" + #line 2785 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1981 "Python/bytecodes.c" + #line 1982 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 2791 "Python/generated_cases.c.h" + #line 2792 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1986 "Python/bytecodes.c" + #line 1987 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2795 "Python/generated_cases.c.h" + #line 2796 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -2800,15 +2801,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 1990 "Python/bytecodes.c" + #line 1991 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 2807 "Python/generated_cases.c.h" + #line 2808 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 1993 "Python/bytecodes.c" + #line 1994 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2812 "Python/generated_cases.c.h" + #line 2813 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -2817,29 +2818,29 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 1997 "Python/bytecodes.c" + #line 1998 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 2825 "Python/generated_cases.c.h" + #line 2826 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 2003 "Python/bytecodes.c" + #line 2004 "Python/bytecodes.c" JUMPBY(oparg); - #line 2834 "Python/generated_cases.c.h" + #line 2835 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); - #line 2007 "Python/bytecodes.c" + #line 2008 "Python/bytecodes.c" assert(oparg < INSTR_OFFSET()); JUMPBY(-oparg); - #line 2843 "Python/generated_cases.c.h" + #line 2844 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } @@ -2847,7 +2848,7 @@ TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; - #line 2013 "Python/bytecodes.c" + #line 2014 "Python/bytecodes.c" if (Py_IsTrue(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2857,9 +2858,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2861 "Python/generated_cases.c.h" + #line 2862 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2023 "Python/bytecodes.c" + #line 2024 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -2867,14 +2868,14 @@ if (err < 0) goto pop_1_error; } } - #line 2871 "Python/generated_cases.c.h" + #line 2872 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2033 "Python/bytecodes.c" + #line 2034 "Python/bytecodes.c" if (Py_IsFalse(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2884,9 +2885,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2888 "Python/generated_cases.c.h" + #line 2889 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2043 "Python/bytecodes.c" + #line 2044 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -2894,67 +2895,67 @@ if (err < 0) goto pop_1_error; } } - #line 2898 "Python/generated_cases.c.h" + #line 2899 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2053 "Python/bytecodes.c" + #line 2054 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 2907 "Python/generated_cases.c.h" + #line 2908 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2055 "Python/bytecodes.c" + #line 2056 "Python/bytecodes.c" JUMPBY(oparg); } else { _Py_DECREF_NO_DEALLOC(value); } - #line 2915 "Python/generated_cases.c.h" + #line 2916 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2063 "Python/bytecodes.c" + #line 2064 "Python/bytecodes.c" if (Py_IsNone(value)) { _Py_DECREF_NO_DEALLOC(value); JUMPBY(oparg); } else { - #line 2928 "Python/generated_cases.c.h" + #line 2929 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2069 "Python/bytecodes.c" + #line 2070 "Python/bytecodes.c" } - #line 2932 "Python/generated_cases.c.h" + #line 2933 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2073 "Python/bytecodes.c" + #line 2074 "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. * (see bpo-30039). */ JUMPBY(-oparg); - #line 2945 "Python/generated_cases.c.h" + #line 2946 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2082 "Python/bytecodes.c" + #line 2083 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 2958 "Python/generated_cases.c.h" + #line 2959 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -2965,16 +2966,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2090 "Python/bytecodes.c" + #line 2091 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 2974 "Python/generated_cases.c.h" + #line 2975 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2095 "Python/bytecodes.c" + #line 2096 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -2982,7 +2983,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_NewRef(Py_None); // Failure! } - #line 2986 "Python/generated_cases.c.h" + #line 2987 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -2991,10 +2992,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2105 "Python/bytecodes.c" + #line 2106 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = Py_NewRef(match ? Py_True : Py_False); - #line 2998 "Python/generated_cases.c.h" + #line 2999 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3004,10 +3005,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2111 "Python/bytecodes.c" + #line 2112 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = Py_NewRef(match ? Py_True : Py_False); - #line 3011 "Python/generated_cases.c.h" + #line 3012 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3018,11 +3019,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2117 "Python/bytecodes.c" + #line 2118 "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; - #line 3026 "Python/generated_cases.c.h" + #line 3027 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3031,14 +3032,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2123 "Python/bytecodes.c" + #line 2124 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3038 "Python/generated_cases.c.h" + #line 3039 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2126 "Python/bytecodes.c" + #line 2127 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3042 "Python/generated_cases.c.h" + #line 3043 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3046,7 +3047,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2130 "Python/bytecodes.c" + #line 2131 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3069,11 +3070,11 @@ if (iter == NULL) { goto error; } - #line 3073 "Python/generated_cases.c.h" + #line 3074 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2153 "Python/bytecodes.c" + #line 2154 "Python/bytecodes.c" } - #line 3077 "Python/generated_cases.c.h" + #line 3078 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -3084,7 +3085,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2172 "Python/bytecodes.c" + #line 2173 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3115,7 +3116,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3119 "Python/generated_cases.c.h" + #line 3120 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3123,7 +3124,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2205 "Python/bytecodes.c" + #line 2206 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3149,14 +3150,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3153 "Python/generated_cases.c.h" + #line 3154 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2233 "Python/bytecodes.c" + #line 2234 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3176,7 +3177,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3180 "Python/generated_cases.c.h" + #line 3181 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3186,7 +3187,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2255 "Python/bytecodes.c" + #line 2256 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3206,7 +3207,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3210 "Python/generated_cases.c.h" + #line 3211 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3216,7 +3217,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2277 "Python/bytecodes.c" + #line 2278 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3234,7 +3235,7 @@ if (next == NULL) { goto error; } - #line 3238 "Python/generated_cases.c.h" + #line 3239 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3243,7 +3244,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2297 "Python/bytecodes.c" + #line 2298 "Python/bytecodes.c" PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, FOR_ITER); @@ -3258,14 +3259,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3262 "Python/generated_cases.c.h" + #line 3263 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2314 "Python/bytecodes.c" + #line 2315 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3288,16 +3289,16 @@ Py_DECREF(enter); goto error; } - #line 3292 "Python/generated_cases.c.h" + #line 3293 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2337 "Python/bytecodes.c" + #line 2338 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3301 "Python/generated_cases.c.h" + #line 3302 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3309,7 +3310,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2347 "Python/bytecodes.c" + #line 2348 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3335,16 +3336,16 @@ Py_DECREF(enter); goto error; } - #line 3339 "Python/generated_cases.c.h" + #line 3340 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2373 "Python/bytecodes.c" + #line 2374 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3348 "Python/generated_cases.c.h" + #line 3349 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3356,7 +3357,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2382 "Python/bytecodes.c" + #line 2383 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3377,7 +3378,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3381 "Python/generated_cases.c.h" + #line 3382 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3386,7 +3387,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2405 "Python/bytecodes.c" + #line 2406 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3396,7 +3397,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3400 "Python/generated_cases.c.h" + #line 3401 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3410,7 +3411,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 2417 "Python/bytecodes.c" + #line 2418 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3427,7 +3428,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3431 "Python/generated_cases.c.h" + #line 3432 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3441,7 +3442,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2436 "Python/bytecodes.c" + #line 2437 "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); @@ -3451,7 +3452,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3455 "Python/generated_cases.c.h" + #line 3456 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3465,7 +3466,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2448 "Python/bytecodes.c" + #line 2449 "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; @@ -3479,7 +3480,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3483 "Python/generated_cases.c.h" + #line 3484 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3488,16 +3489,16 @@ } TARGET(KW_NAMES) { - #line 2464 "Python/bytecodes.c" + #line 2465 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(frame->f_code->co_consts)); kwnames = GETITEM(frame->f_code->co_consts, oparg); - #line 3496 "Python/generated_cases.c.h" + #line 3497 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2470 "Python/bytecodes.c" + #line 2471 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3510,7 +3511,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3514 "Python/generated_cases.c.h" + #line 3515 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3520,7 +3521,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2515 "Python/bytecodes.c" + #line 2516 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3602,7 +3603,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3606 "Python/generated_cases.c.h" + #line 3607 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3614,7 +3615,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2603 "Python/bytecodes.c" + #line 2604 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3624,7 +3625,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3628 "Python/generated_cases.c.h" + #line 3629 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3633,7 +3634,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2615 "Python/bytecodes.c" + #line 2616 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3659,7 +3660,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3663 "Python/generated_cases.c.h" + #line 3664 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3667,7 +3668,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2643 "Python/bytecodes.c" + #line 2644 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3703,7 +3704,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3707 "Python/generated_cases.c.h" + #line 3708 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -3711,7 +3712,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2681 "Python/bytecodes.c" + #line 2682 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3721,7 +3722,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 3725 "Python/generated_cases.c.h" + #line 3726 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3734,7 +3735,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2693 "Python/bytecodes.c" + #line 2694 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3745,7 +3746,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3749 "Python/generated_cases.c.h" + #line 3750 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3759,7 +3760,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2707 "Python/bytecodes.c" + #line 2708 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3770,7 +3771,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3774 "Python/generated_cases.c.h" + #line 3775 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3784,7 +3785,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2721 "Python/bytecodes.c" + #line 2722 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3806,7 +3807,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3810 "Python/generated_cases.c.h" + #line 3811 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3820,7 +3821,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2746 "Python/bytecodes.c" + #line 2747 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3848,7 +3849,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3852 "Python/generated_cases.c.h" + #line 3853 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3862,7 +3863,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2777 "Python/bytecodes.c" + #line 2778 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3894,7 +3895,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 3898 "Python/generated_cases.c.h" + #line 3899 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3908,7 +3909,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2812 "Python/bytecodes.c" + #line 2813 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -3940,7 +3941,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3944 "Python/generated_cases.c.h" + #line 3945 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3954,7 +3955,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2847 "Python/bytecodes.c" + #line 2848 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -3979,7 +3980,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3983 "Python/generated_cases.c.h" + #line 3984 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3992,7 +3993,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2874 "Python/bytecodes.c" + #line 2875 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4019,7 +4020,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4023 "Python/generated_cases.c.h" + #line 4024 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4031,7 +4032,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2904 "Python/bytecodes.c" + #line 2905 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4049,14 +4050,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4053 "Python/generated_cases.c.h" + #line 4054 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2924 "Python/bytecodes.c" + #line 2925 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4087,7 +4088,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4091 "Python/generated_cases.c.h" + #line 4092 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4100,7 +4101,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2958 "Python/bytecodes.c" + #line 2959 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4129,7 +4130,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4133 "Python/generated_cases.c.h" + #line 4134 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4142,7 +4143,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2990 "Python/bytecodes.c" + #line 2991 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4171,7 +4172,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4175 "Python/generated_cases.c.h" + #line 4176 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4184,7 +4185,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3022 "Python/bytecodes.c" + #line 3023 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4212,7 +4213,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4216 "Python/generated_cases.c.h" + #line 4217 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4222,9 +4223,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3053 "Python/bytecodes.c" + #line 3054 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4228 "Python/generated_cases.c.h" + #line 4229 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4233,7 +4234,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3057 "Python/bytecodes.c" + #line 3058 "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)); @@ -4276,14 +4277,14 @@ else { result = PyObject_Call(func, callargs, kwargs); } - #line 4280 "Python/generated_cases.c.h" + #line 4281 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3100 "Python/bytecodes.c" + #line 3101 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4287 "Python/generated_cases.c.h" + #line 4288 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4298,7 +4299,7 @@ PyObject *kwdefaults = (oparg & 0x02) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0))] : NULL; PyObject *defaults = (oparg & 0x01) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x01) ? 1 : 0))] : NULL; PyObject *func; - #line 3110 "Python/bytecodes.c" + #line 3111 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4327,14 +4328,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4331 "Python/generated_cases.c.h" + #line 4332 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 0x01) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x08) ? 1 : 0)); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3141 "Python/bytecodes.c" + #line 3142 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4355,7 +4356,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4359 "Python/generated_cases.c.h" + #line 4360 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4363,15 +4364,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3164 "Python/bytecodes.c" + #line 3165 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4369 "Python/generated_cases.c.h" + #line 4370 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3166 "Python/bytecodes.c" + #line 3167 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4375 "Python/generated_cases.c.h" + #line 4376 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4382,7 +4383,7 @@ 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))]; PyObject *result; - #line 3170 "Python/bytecodes.c" + #line 3171 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4417,7 +4418,7 @@ 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 4421 "Python/generated_cases.c.h" + #line 4422 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4426,10 +4427,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3207 "Python/bytecodes.c" + #line 3208 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4433 "Python/generated_cases.c.h" + #line 4434 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4441,7 +4442,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3212 "Python/bytecodes.c" + #line 3213 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4456,12 +4457,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4460 "Python/generated_cases.c.h" + #line 4461 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3227 "Python/bytecodes.c" + #line 3228 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4465 "Python/generated_cases.c.h" + #line 4466 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4471,16 +4472,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3232 "Python/bytecodes.c" + #line 3233 "Python/bytecodes.c" assert(oparg >= 2); - #line 4477 "Python/generated_cases.c.h" + #line 4478 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_LINE) { - #line 3236 "Python/bytecodes.c" + #line 3237 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _PyFrame_SetStackPointer(frame, stack_pointer); int original_opcode = _Py_call_instrumentation_line( @@ -4500,11 +4501,11 @@ } opcode = original_opcode; DISPATCH_GOTO(); - #line 4504 "Python/generated_cases.c.h" + #line 4505 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3258 "Python/bytecodes.c" + #line 3259 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4516,26 +4517,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4520 "Python/generated_cases.c.h" + #line 4521 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3272 "Python/bytecodes.c" + #line 3273 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4526 "Python/generated_cases.c.h" + #line 4527 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3276 "Python/bytecodes.c" + #line 3277 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr-oparg, PY_MONITORING_EVENT_JUMP); - #line 4533 "Python/generated_cases.c.h" + #line 4534 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3281 "Python/bytecodes.c" + #line 3282 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4544,12 +4545,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4548 "Python/generated_cases.c.h" + #line 4549 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3292 "Python/bytecodes.c" + #line 3293 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4558,12 +4559,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4562 "Python/generated_cases.c.h" + #line 4563 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3303 "Python/bytecodes.c" + #line 3304 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4576,12 +4577,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4580 "Python/generated_cases.c.h" + #line 4581 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3318 "Python/bytecodes.c" + #line 3319 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4594,30 +4595,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4598 "Python/generated_cases.c.h" + #line 4599 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3333 "Python/bytecodes.c" + #line 3334 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4609 "Python/generated_cases.c.h" + #line 4610 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3341 "Python/bytecodes.c" + #line 3342 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4616 "Python/generated_cases.c.h" + #line 4617 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3346 "Python/bytecodes.c" + #line 3347 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4623 "Python/generated_cases.c.h" + #line 4624 "Python/generated_cases.c.h" } From e4466a7a0e16393c6bf0c0d2ed7ae03cb0d8b0e1 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 19 Apr 2023 15:58:53 -0700 Subject: [PATCH 14/16] simplify oparg & 2 handling --- Doc/library/dis.rst | 4 +- Python/bytecodes.c | 9 +- Python/compile.c | 6 +- Python/generated_cases.c.h | 454 ++++++++++++++++++------------------- 4 files changed, 232 insertions(+), 241 deletions(-) diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index c8897b34f0ddfd..3894837127877c 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -1048,8 +1048,8 @@ iterations of the loop. The low bit of ``namei`` signals to attempt a method load, as with :opcode:`LOAD_ATTR`. - The second-low bit of ``namei``, if set, means that this was a zero-argument - call to :func:`super`. + The second-low bit of ``namei``, if set, means that this was a two-argument + call to :func:`super` (unset means zero-argument). .. versionadded:: 3.12 diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 0ad9f326cec8a6..437868653cc024 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -1574,13 +1574,8 @@ dummy_func( Py_DECREF(self); } } else { - PyObject *super; - if (oparg & 2) { - super = PyObject_CallNoArgs(global_super); - } else { - PyObject *stack[] = {class, self}; - super = PyObject_Vectorcall(global_super, stack, 2, NULL); - } + PyObject *stack[] = {class, self}; + PyObject *super = PyObject_Vectorcall(global_super, stack, oparg & 2, NULL); DECREF_INPUTS(); ERROR_IF(super == NULL, error); res = PyObject_GetAttr(super, name); diff --git a/Python/compile.c b/Python/compile.c index bcef92665bcb9c..a6ef25901973a8 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -1053,21 +1053,21 @@ compiler_addop_name(struct compiler_unit *u, location loc, } if (opcode == LOAD_SUPER_ATTR) { arg <<= 2; + arg |= 2; } if (opcode == LOAD_SUPER_METHOD) { opcode = LOAD_SUPER_ATTR; arg <<= 2; - arg |= 1; + arg |= 3; } if (opcode == LOAD_ZERO_SUPER_ATTR) { opcode = LOAD_SUPER_ATTR; arg <<= 2; - arg |= 2; } if (opcode == LOAD_ZERO_SUPER_METHOD) { opcode = LOAD_SUPER_ATTR; arg <<= 2; - arg |= 3; + arg |= 1; } return codegen_addop_i(&u->u_instr_sequence, opcode, arg, loc); } diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 0cd7137669012b..0d8ce579209fd9 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -2194,23 +2194,19 @@ } } else { PyObject *super; - if (oparg & 2) { - super = PyObject_CallNoArgs(global_super); - } else { - PyObject *stack[] = {class, self}; - super = PyObject_Vectorcall(global_super, stack, 2, NULL); - } - #line 2204 "Python/generated_cases.c.h" + PyObject *stack[] = {class, self}; + super = PyObject_Vectorcall(global_super, stack, oparg & 2, NULL); + #line 2200 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1585 "Python/bytecodes.c" + #line 1581 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); if (res == NULL) goto pop_3_error; } - #line 2214 "Python/generated_cases.c.h" + #line 2210 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2224,7 +2220,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1607 "Python/bytecodes.c" + #line 1603 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2258,9 +2254,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2262 "Python/generated_cases.c.h" + #line 2258 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1641 "Python/bytecodes.c" + #line 1637 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2269,12 +2265,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2273 "Python/generated_cases.c.h" + #line 2269 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1650 "Python/bytecodes.c" + #line 1646 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2278 "Python/generated_cases.c.h" + #line 2274 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -2288,7 +2284,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1655 "Python/bytecodes.c" + #line 1651 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2301,7 +2297,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2305 "Python/generated_cases.c.h" + #line 2301 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2316,7 +2312,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1671 "Python/bytecodes.c" + #line 1667 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2329,7 +2325,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2333 "Python/generated_cases.c.h" + #line 2329 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2344,7 +2340,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1687 "Python/bytecodes.c" + #line 1683 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2371,7 +2367,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2375 "Python/generated_cases.c.h" + #line 2371 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2386,7 +2382,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1717 "Python/bytecodes.c" + #line 1713 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2396,7 +2392,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2400 "Python/generated_cases.c.h" + #line 2396 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2411,7 +2407,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1730 "Python/bytecodes.c" + #line 1726 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2423,7 +2419,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2427 "Python/generated_cases.c.h" + #line 2423 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2437,7 +2433,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 1745 "Python/bytecodes.c" + #line 1741 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2461,7 +2457,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2465 "Python/generated_cases.c.h" + #line 2461 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2469,7 +2465,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 1771 "Python/bytecodes.c" + #line 1767 "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); @@ -2495,7 +2491,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2499 "Python/generated_cases.c.h" + #line 2495 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2503,7 +2499,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 1799 "Python/bytecodes.c" + #line 1795 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2521,7 +2517,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2525 "Python/generated_cases.c.h" + #line 2521 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2532,7 +2528,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 1819 "Python/bytecodes.c" + #line 1815 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2571,7 +2567,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2575 "Python/generated_cases.c.h" + #line 2571 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2582,7 +2578,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 1860 "Python/bytecodes.c" + #line 1856 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2592,7 +2588,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2596 "Python/generated_cases.c.h" + #line 2592 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2604,7 +2600,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1879 "Python/bytecodes.c" + #line 1875 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2617,12 +2613,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); - #line 2621 "Python/generated_cases.c.h" + #line 2617 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1892 "Python/bytecodes.c" + #line 1888 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2626 "Python/generated_cases.c.h" + #line 2622 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2633,7 +2629,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1896 "Python/bytecodes.c" + #line 1892 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2645,7 +2641,7 @@ _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2649 "Python/generated_cases.c.h" + #line 2645 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2656,7 +2652,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1911 "Python/bytecodes.c" + #line 1907 "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); @@ -2672,7 +2668,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2676 "Python/generated_cases.c.h" + #line 2672 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2683,7 +2679,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1930 "Python/bytecodes.c" + #line 1926 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2696,7 +2692,7 @@ assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2700 "Python/generated_cases.c.h" + #line 2696 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2707,14 +2703,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1945 "Python/bytecodes.c" + #line 1941 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 2713 "Python/generated_cases.c.h" + #line 2709 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1947 "Python/bytecodes.c" + #line 1943 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2718 "Python/generated_cases.c.h" + #line 2714 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2724,15 +2720,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1951 "Python/bytecodes.c" + #line 1947 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 2730 "Python/generated_cases.c.h" + #line 2726 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1953 "Python/bytecodes.c" + #line 1949 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = Py_NewRef((res^oparg) ? Py_True : Py_False); - #line 2736 "Python/generated_cases.c.h" + #line 2732 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2743,12 +2739,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 1958 "Python/bytecodes.c" + #line 1954 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 2749 "Python/generated_cases.c.h" + #line 2745 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1960 "Python/bytecodes.c" + #line 1956 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -2756,10 +2752,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 2760 "Python/generated_cases.c.h" + #line 2756 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1968 "Python/bytecodes.c" + #line 1964 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -2768,7 +2764,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 2772 "Python/generated_cases.c.h" + #line 2768 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -2778,21 +2774,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1979 "Python/bytecodes.c" + #line 1975 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 2785 "Python/generated_cases.c.h" + #line 2781 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1982 "Python/bytecodes.c" + #line 1978 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 2792 "Python/generated_cases.c.h" + #line 2788 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1987 "Python/bytecodes.c" + #line 1983 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2796 "Python/generated_cases.c.h" + #line 2792 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -2801,15 +2797,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 1991 "Python/bytecodes.c" + #line 1987 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 2808 "Python/generated_cases.c.h" + #line 2804 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 1994 "Python/bytecodes.c" + #line 1990 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2813 "Python/generated_cases.c.h" + #line 2809 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -2818,29 +2814,29 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 1998 "Python/bytecodes.c" + #line 1994 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 2826 "Python/generated_cases.c.h" + #line 2822 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 2004 "Python/bytecodes.c" + #line 2000 "Python/bytecodes.c" JUMPBY(oparg); - #line 2835 "Python/generated_cases.c.h" + #line 2831 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); - #line 2008 "Python/bytecodes.c" + #line 2004 "Python/bytecodes.c" assert(oparg < INSTR_OFFSET()); JUMPBY(-oparg); - #line 2844 "Python/generated_cases.c.h" + #line 2840 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } @@ -2848,7 +2844,7 @@ TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; - #line 2014 "Python/bytecodes.c" + #line 2010 "Python/bytecodes.c" if (Py_IsTrue(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2858,9 +2854,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2862 "Python/generated_cases.c.h" + #line 2858 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2024 "Python/bytecodes.c" + #line 2020 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -2868,14 +2864,14 @@ if (err < 0) goto pop_1_error; } } - #line 2872 "Python/generated_cases.c.h" + #line 2868 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2034 "Python/bytecodes.c" + #line 2030 "Python/bytecodes.c" if (Py_IsFalse(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2885,9 +2881,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2889 "Python/generated_cases.c.h" + #line 2885 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2044 "Python/bytecodes.c" + #line 2040 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -2895,67 +2891,67 @@ if (err < 0) goto pop_1_error; } } - #line 2899 "Python/generated_cases.c.h" + #line 2895 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2054 "Python/bytecodes.c" + #line 2050 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 2908 "Python/generated_cases.c.h" + #line 2904 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2056 "Python/bytecodes.c" + #line 2052 "Python/bytecodes.c" JUMPBY(oparg); } else { _Py_DECREF_NO_DEALLOC(value); } - #line 2916 "Python/generated_cases.c.h" + #line 2912 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2064 "Python/bytecodes.c" + #line 2060 "Python/bytecodes.c" if (Py_IsNone(value)) { _Py_DECREF_NO_DEALLOC(value); JUMPBY(oparg); } else { - #line 2929 "Python/generated_cases.c.h" + #line 2925 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2070 "Python/bytecodes.c" + #line 2066 "Python/bytecodes.c" } - #line 2933 "Python/generated_cases.c.h" + #line 2929 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2074 "Python/bytecodes.c" + #line 2070 "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. * (see bpo-30039). */ JUMPBY(-oparg); - #line 2946 "Python/generated_cases.c.h" + #line 2942 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2083 "Python/bytecodes.c" + #line 2079 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 2959 "Python/generated_cases.c.h" + #line 2955 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -2966,16 +2962,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2091 "Python/bytecodes.c" + #line 2087 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 2975 "Python/generated_cases.c.h" + #line 2971 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2096 "Python/bytecodes.c" + #line 2092 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -2983,7 +2979,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_NewRef(Py_None); // Failure! } - #line 2987 "Python/generated_cases.c.h" + #line 2983 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -2992,10 +2988,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2106 "Python/bytecodes.c" + #line 2102 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = Py_NewRef(match ? Py_True : Py_False); - #line 2999 "Python/generated_cases.c.h" + #line 2995 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3005,10 +3001,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2112 "Python/bytecodes.c" + #line 2108 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = Py_NewRef(match ? Py_True : Py_False); - #line 3012 "Python/generated_cases.c.h" + #line 3008 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3019,11 +3015,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2118 "Python/bytecodes.c" + #line 2114 "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; - #line 3027 "Python/generated_cases.c.h" + #line 3023 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3032,14 +3028,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2124 "Python/bytecodes.c" + #line 2120 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3039 "Python/generated_cases.c.h" + #line 3035 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2127 "Python/bytecodes.c" + #line 2123 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3043 "Python/generated_cases.c.h" + #line 3039 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3047,7 +3043,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2131 "Python/bytecodes.c" + #line 2127 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3070,11 +3066,11 @@ if (iter == NULL) { goto error; } - #line 3074 "Python/generated_cases.c.h" + #line 3070 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2154 "Python/bytecodes.c" + #line 2150 "Python/bytecodes.c" } - #line 3078 "Python/generated_cases.c.h" + #line 3074 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -3085,7 +3081,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2173 "Python/bytecodes.c" + #line 2169 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3116,7 +3112,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3120 "Python/generated_cases.c.h" + #line 3116 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3124,7 +3120,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2206 "Python/bytecodes.c" + #line 2202 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3150,14 +3146,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3154 "Python/generated_cases.c.h" + #line 3150 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2234 "Python/bytecodes.c" + #line 2230 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3177,7 +3173,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3181 "Python/generated_cases.c.h" + #line 3177 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3187,7 +3183,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2256 "Python/bytecodes.c" + #line 2252 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3207,7 +3203,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3211 "Python/generated_cases.c.h" + #line 3207 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3217,7 +3213,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2278 "Python/bytecodes.c" + #line 2274 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3235,7 +3231,7 @@ if (next == NULL) { goto error; } - #line 3239 "Python/generated_cases.c.h" + #line 3235 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3244,7 +3240,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2298 "Python/bytecodes.c" + #line 2294 "Python/bytecodes.c" PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, FOR_ITER); @@ -3259,14 +3255,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3263 "Python/generated_cases.c.h" + #line 3259 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2315 "Python/bytecodes.c" + #line 2311 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3289,16 +3285,16 @@ Py_DECREF(enter); goto error; } - #line 3293 "Python/generated_cases.c.h" + #line 3289 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2338 "Python/bytecodes.c" + #line 2334 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3302 "Python/generated_cases.c.h" + #line 3298 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3310,7 +3306,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2348 "Python/bytecodes.c" + #line 2344 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3336,16 +3332,16 @@ Py_DECREF(enter); goto error; } - #line 3340 "Python/generated_cases.c.h" + #line 3336 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2374 "Python/bytecodes.c" + #line 2370 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3349 "Python/generated_cases.c.h" + #line 3345 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3357,7 +3353,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2383 "Python/bytecodes.c" + #line 2379 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3378,7 +3374,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3382 "Python/generated_cases.c.h" + #line 3378 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3387,7 +3383,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2406 "Python/bytecodes.c" + #line 2402 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3397,7 +3393,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3401 "Python/generated_cases.c.h" + #line 3397 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3411,7 +3407,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 2418 "Python/bytecodes.c" + #line 2414 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3428,7 +3424,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3432 "Python/generated_cases.c.h" + #line 3428 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3442,7 +3438,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2437 "Python/bytecodes.c" + #line 2433 "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); @@ -3452,7 +3448,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3456 "Python/generated_cases.c.h" + #line 3452 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3466,7 +3462,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2449 "Python/bytecodes.c" + #line 2445 "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; @@ -3480,7 +3476,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3484 "Python/generated_cases.c.h" + #line 3480 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3489,16 +3485,16 @@ } TARGET(KW_NAMES) { - #line 2465 "Python/bytecodes.c" + #line 2461 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(frame->f_code->co_consts)); kwnames = GETITEM(frame->f_code->co_consts, oparg); - #line 3497 "Python/generated_cases.c.h" + #line 3493 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2471 "Python/bytecodes.c" + #line 2467 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3511,7 +3507,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3515 "Python/generated_cases.c.h" + #line 3511 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3521,7 +3517,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2516 "Python/bytecodes.c" + #line 2512 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3603,7 +3599,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3607 "Python/generated_cases.c.h" + #line 3603 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3615,7 +3611,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2604 "Python/bytecodes.c" + #line 2600 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3625,7 +3621,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3629 "Python/generated_cases.c.h" + #line 3625 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3634,7 +3630,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2616 "Python/bytecodes.c" + #line 2612 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3660,7 +3656,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3664 "Python/generated_cases.c.h" + #line 3660 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3668,7 +3664,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2644 "Python/bytecodes.c" + #line 2640 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3704,7 +3700,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3708 "Python/generated_cases.c.h" + #line 3704 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -3712,7 +3708,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2682 "Python/bytecodes.c" + #line 2678 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3722,7 +3718,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 3726 "Python/generated_cases.c.h" + #line 3722 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3735,7 +3731,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2694 "Python/bytecodes.c" + #line 2690 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3746,7 +3742,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3750 "Python/generated_cases.c.h" + #line 3746 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3760,7 +3756,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2708 "Python/bytecodes.c" + #line 2704 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3771,7 +3767,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3775 "Python/generated_cases.c.h" + #line 3771 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3785,7 +3781,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2722 "Python/bytecodes.c" + #line 2718 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3807,7 +3803,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3811 "Python/generated_cases.c.h" + #line 3807 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3821,7 +3817,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2747 "Python/bytecodes.c" + #line 2743 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3849,7 +3845,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3853 "Python/generated_cases.c.h" + #line 3849 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3863,7 +3859,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2778 "Python/bytecodes.c" + #line 2774 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3895,7 +3891,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 3899 "Python/generated_cases.c.h" + #line 3895 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3909,7 +3905,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2813 "Python/bytecodes.c" + #line 2809 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -3941,7 +3937,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3945 "Python/generated_cases.c.h" + #line 3941 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3955,7 +3951,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2848 "Python/bytecodes.c" + #line 2844 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -3980,7 +3976,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3984 "Python/generated_cases.c.h" + #line 3980 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3993,7 +3989,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2875 "Python/bytecodes.c" + #line 2871 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4020,7 +4016,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4024 "Python/generated_cases.c.h" + #line 4020 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4032,7 +4028,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2905 "Python/bytecodes.c" + #line 2901 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4050,14 +4046,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4054 "Python/generated_cases.c.h" + #line 4050 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2925 "Python/bytecodes.c" + #line 2921 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4088,7 +4084,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4092 "Python/generated_cases.c.h" + #line 4088 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4101,7 +4097,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2959 "Python/bytecodes.c" + #line 2955 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4130,7 +4126,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4134 "Python/generated_cases.c.h" + #line 4130 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4143,7 +4139,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2991 "Python/bytecodes.c" + #line 2987 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4172,7 +4168,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4176 "Python/generated_cases.c.h" + #line 4172 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4185,7 +4181,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3023 "Python/bytecodes.c" + #line 3019 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4213,7 +4209,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4217 "Python/generated_cases.c.h" + #line 4213 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4223,9 +4219,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3054 "Python/bytecodes.c" + #line 3050 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4229 "Python/generated_cases.c.h" + #line 4225 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4234,7 +4230,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3058 "Python/bytecodes.c" + #line 3054 "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)); @@ -4277,14 +4273,14 @@ else { result = PyObject_Call(func, callargs, kwargs); } - #line 4281 "Python/generated_cases.c.h" + #line 4277 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3101 "Python/bytecodes.c" + #line 3097 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4288 "Python/generated_cases.c.h" + #line 4284 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4299,7 +4295,7 @@ PyObject *kwdefaults = (oparg & 0x02) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0))] : NULL; PyObject *defaults = (oparg & 0x01) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x01) ? 1 : 0))] : NULL; PyObject *func; - #line 3111 "Python/bytecodes.c" + #line 3107 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4328,14 +4324,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4332 "Python/generated_cases.c.h" + #line 4328 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 0x01) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x08) ? 1 : 0)); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3142 "Python/bytecodes.c" + #line 3138 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4356,7 +4352,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4360 "Python/generated_cases.c.h" + #line 4356 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4364,15 +4360,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3165 "Python/bytecodes.c" + #line 3161 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4370 "Python/generated_cases.c.h" + #line 4366 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3167 "Python/bytecodes.c" + #line 3163 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4376 "Python/generated_cases.c.h" + #line 4372 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4383,7 +4379,7 @@ 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))]; PyObject *result; - #line 3171 "Python/bytecodes.c" + #line 3167 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4418,7 +4414,7 @@ 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 4422 "Python/generated_cases.c.h" + #line 4418 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4427,10 +4423,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3208 "Python/bytecodes.c" + #line 3204 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4434 "Python/generated_cases.c.h" + #line 4430 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4442,7 +4438,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3213 "Python/bytecodes.c" + #line 3209 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4457,12 +4453,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4461 "Python/generated_cases.c.h" + #line 4457 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3228 "Python/bytecodes.c" + #line 3224 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4466 "Python/generated_cases.c.h" + #line 4462 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4472,16 +4468,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3233 "Python/bytecodes.c" + #line 3229 "Python/bytecodes.c" assert(oparg >= 2); - #line 4478 "Python/generated_cases.c.h" + #line 4474 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_LINE) { - #line 3237 "Python/bytecodes.c" + #line 3233 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _PyFrame_SetStackPointer(frame, stack_pointer); int original_opcode = _Py_call_instrumentation_line( @@ -4501,11 +4497,11 @@ } opcode = original_opcode; DISPATCH_GOTO(); - #line 4505 "Python/generated_cases.c.h" + #line 4501 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3259 "Python/bytecodes.c" + #line 3255 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4517,26 +4513,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4521 "Python/generated_cases.c.h" + #line 4517 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3273 "Python/bytecodes.c" + #line 3269 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4527 "Python/generated_cases.c.h" + #line 4523 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3277 "Python/bytecodes.c" + #line 3273 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr-oparg, PY_MONITORING_EVENT_JUMP); - #line 4534 "Python/generated_cases.c.h" + #line 4530 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3282 "Python/bytecodes.c" + #line 3278 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4545,12 +4541,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4549 "Python/generated_cases.c.h" + #line 4545 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3293 "Python/bytecodes.c" + #line 3289 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4559,12 +4555,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4563 "Python/generated_cases.c.h" + #line 4559 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3304 "Python/bytecodes.c" + #line 3300 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4577,12 +4573,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4581 "Python/generated_cases.c.h" + #line 4577 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3319 "Python/bytecodes.c" + #line 3315 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4595,30 +4591,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4599 "Python/generated_cases.c.h" + #line 4595 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3334 "Python/bytecodes.c" + #line 3330 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4610 "Python/generated_cases.c.h" + #line 4606 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3342 "Python/bytecodes.c" + #line 3338 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4617 "Python/generated_cases.c.h" + #line 4613 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3347 "Python/bytecodes.c" + #line 3343 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4624 "Python/generated_cases.c.h" + #line 4620 "Python/generated_cases.c.h" } From f16126880434ee8ee005a6a00dcac9d86ff20720 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 19 Apr 2023 20:37:31 -0700 Subject: [PATCH 15/16] cleanup and clarification --- Objects/typeobject.c | 24 +- Python/bytecodes.c | 6 +- Python/generated_cases.c.h | 455 ++++++++++++++++++------------------- 3 files changed, 242 insertions(+), 243 deletions(-) diff --git a/Objects/typeobject.c b/Objects/typeobject.c index 403b09c39eb963..c52437a2c18e3e 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -9357,17 +9357,17 @@ super_repr(PyObject *self) su->type ? su->type->tp_name : "NULL"); } +// if `method` is non-NULL, we are looking for a method descriptor, +// and setting `*method` to 1 means we found one. static PyObject * do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj, - PyTypeObject *su_obj_type, PyObject *name, int *meth_found) + PyTypeObject *su_obj_type, PyObject *name, int *method) { - PyTypeObject *starttype; PyObject *mro, *res; Py_ssize_t i, n; int temp_su = 0; - starttype = su_obj_type; - if (starttype == NULL) + if (su_obj_type == NULL) goto skip; /* We want __class__ to return the class of the super object @@ -9377,7 +9377,7 @@ do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj, _PyUnicode_Equal(name, &_Py_ID(__class__))) goto skip; - mro = starttype->tp_mro; + mro = su_obj_type->tp_mro; if (mro == NULL) goto skip; @@ -9393,7 +9393,7 @@ do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj, if (i >= n) goto skip; - /* keep a strong reference to mro because starttype->tp_mro can be + /* keep a strong reference to mro because su_obj_type->tp_mro can be replaced during PyDict_GetItemWithError(dict, name) */ Py_INCREF(mro); do { @@ -9404,8 +9404,8 @@ do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj, res = PyDict_GetItemWithError(dict, name); if (res != NULL) { Py_INCREF(res); - if (meth_found && _PyType_HasFeature(Py_TYPE(res), Py_TPFLAGS_METHOD_DESCRIPTOR)) { - *meth_found = 1; + if (method && _PyType_HasFeature(Py_TYPE(res), Py_TPFLAGS_METHOD_DESCRIPTOR)) { + *method = 1; } else { descrgetfunc f = Py_TYPE(res)->tp_descr_get; @@ -9414,8 +9414,8 @@ do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj, res2 = f(res, /* Only pass 'obj' param if this is instance-mode super (See SF ID #743627) */ - (su_obj == (PyObject *)starttype) ? NULL : su_obj, - (PyObject *)starttype); + (su_obj == (PyObject *)su_obj_type) ? NULL : su_obj, + (PyObject *)su_obj_type); Py_SETREF(res, res2); } } @@ -9509,13 +9509,13 @@ supercheck(PyTypeObject *type, PyObject *obj) } PyObject * -_PySuper_Lookup(PyTypeObject *su_type, PyObject *su_obj, PyObject *name, int *meth_found) +_PySuper_Lookup(PyTypeObject *su_type, PyObject *su_obj, PyObject *name, int *method) { PyTypeObject *su_obj_type = supercheck(su_type, su_obj); if (su_obj_type == NULL) { return NULL; } - PyObject *res = do_super_lookup(NULL, su_type, su_obj, su_obj_type, name, meth_found); + PyObject *res = do_super_lookup(NULL, su_type, su_obj, su_obj_type, name, method); Py_DECREF(su_obj_type); return res; } diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 437868653cc024..dc66059cc81cc0 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -1557,16 +1557,16 @@ dummy_func( inst(LOAD_SUPER_ATTR, (global_super, class, self -- res2 if (oparg & 1), res)) { PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); if (global_super == (PyObject *)&PySuper_Type && PyType_Check(class)) { - int meth_found = 0; + int method = 0; Py_DECREF(global_super); - res = _PySuper_Lookup((PyTypeObject *)class, self, name, oparg & 1 ? &meth_found : NULL); + res = _PySuper_Lookup((PyTypeObject *)class, self, name, oparg & 1 ? &method : NULL); Py_DECREF(class); if (res == NULL) { Py_DECREF(self); ERROR_IF(true, error); } // Works with CALL, pushes two values: either `meth | self` or `NULL | meth`. - if (meth_found) { + if (method) { res2 = res; res = self; // transfer ownership } else { diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h index 0d8ce579209fd9..0b5a91f7a1d94a 100644 --- a/Python/generated_cases.c.h +++ b/Python/generated_cases.c.h @@ -2176,16 +2176,16 @@ #line 1558 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2); if (global_super == (PyObject *)&PySuper_Type && PyType_Check(class)) { - int meth_found = 0; + int method = 0; Py_DECREF(global_super); - res = _PySuper_Lookup((PyTypeObject *)class, self, name, oparg & 1 ? &meth_found : NULL); + res = _PySuper_Lookup((PyTypeObject *)class, self, name, oparg & 1 ? &method : NULL); Py_DECREF(class); if (res == NULL) { Py_DECREF(self); if (true) goto pop_3_error; } // Works with CALL, pushes two values: either `meth | self` or `NULL | meth`. - if (meth_found) { + if (method) { res2 = res; res = self; // transfer ownership } else { @@ -2193,20 +2193,19 @@ Py_DECREF(self); } } else { - PyObject *super; PyObject *stack[] = {class, self}; - super = PyObject_Vectorcall(global_super, stack, oparg & 2, NULL); - #line 2200 "Python/generated_cases.c.h" + PyObject *super = PyObject_Vectorcall(global_super, stack, oparg & 2, NULL); + #line 2199 "Python/generated_cases.c.h" Py_DECREF(global_super); Py_DECREF(class); Py_DECREF(self); - #line 1581 "Python/bytecodes.c" + #line 1580 "Python/bytecodes.c" if (super == NULL) goto pop_3_error; res = PyObject_GetAttr(super, name); Py_DECREF(super); if (res == NULL) goto pop_3_error; } - #line 2210 "Python/generated_cases.c.h" + #line 2209 "Python/generated_cases.c.h" STACK_SHRINK(2); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2220,7 +2219,7 @@ PyObject *owner = stack_pointer[-1]; PyObject *res2 = NULL; PyObject *res; - #line 1603 "Python/bytecodes.c" + #line 1602 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyAttrCache *cache = (_PyAttrCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2254,9 +2253,9 @@ NULL | meth | arg1 | ... | argN */ - #line 2258 "Python/generated_cases.c.h" + #line 2257 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1637 "Python/bytecodes.c" + #line 1636 "Python/bytecodes.c" if (meth == NULL) goto pop_1_error; res2 = NULL; res = meth; @@ -2265,12 +2264,12 @@ else { /* Classic, pushes one value. */ res = PyObject_GetAttr(owner, name); - #line 2269 "Python/generated_cases.c.h" + #line 2268 "Python/generated_cases.c.h" Py_DECREF(owner); - #line 1646 "Python/bytecodes.c" + #line 1645 "Python/bytecodes.c" if (res == NULL) goto pop_1_error; } - #line 2274 "Python/generated_cases.c.h" + #line 2273 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -2284,7 +2283,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1651 "Python/bytecodes.c" + #line 1650 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2297,7 +2296,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2301 "Python/generated_cases.c.h" + #line 2300 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2312,7 +2311,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1667 "Python/bytecodes.c" + #line 1666 "Python/bytecodes.c" DEOPT_IF(!PyModule_CheckExact(owner), LOAD_ATTR); PyDictObject *dict = (PyDictObject *)((PyModuleObject *)owner)->md_dict; assert(dict != NULL); @@ -2325,7 +2324,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2329 "Python/generated_cases.c.h" + #line 2328 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2340,7 +2339,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1683 "Python/bytecodes.c" + #line 1682 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2367,7 +2366,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2371 "Python/generated_cases.c.h" + #line 2370 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2382,7 +2381,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); uint16_t index = read_u16(&next_instr[3].cache); - #line 1713 "Python/bytecodes.c" + #line 1712 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, LOAD_ATTR); @@ -2392,7 +2391,7 @@ STAT_INC(LOAD_ATTR, hit); Py_INCREF(res); res2 = NULL; - #line 2396 "Python/generated_cases.c.h" + #line 2395 "Python/generated_cases.c.h" Py_DECREF(owner); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2407,7 +2406,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 1726 "Python/bytecodes.c" + #line 1725 "Python/bytecodes.c" DEOPT_IF(!PyType_Check(cls), LOAD_ATTR); DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version, @@ -2419,7 +2418,7 @@ res = descr; assert(res != NULL); Py_INCREF(res); - #line 2423 "Python/generated_cases.c.h" + #line 2422 "Python/generated_cases.c.h" Py_DECREF(cls); STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; @@ -2433,7 +2432,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 1741 "Python/bytecodes.c" + #line 1740 "Python/bytecodes.c" DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR); PyTypeObject *cls = Py_TYPE(owner); @@ -2457,7 +2456,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2461 "Python/generated_cases.c.h" + #line 2460 "Python/generated_cases.c.h" } TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) { @@ -2465,7 +2464,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 1767 "Python/bytecodes.c" + #line 1766 "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); @@ -2491,7 +2490,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 2495 "Python/generated_cases.c.h" + #line 2494 "Python/generated_cases.c.h" } TARGET(STORE_ATTR_INSTANCE_VALUE) { @@ -2499,7 +2498,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 1795 "Python/bytecodes.c" + #line 1794 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2517,7 +2516,7 @@ Py_DECREF(old_value); } Py_DECREF(owner); - #line 2521 "Python/generated_cases.c.h" + #line 2520 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2528,7 +2527,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 1815 "Python/bytecodes.c" + #line 1814 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2567,7 +2566,7 @@ /* PEP 509 */ dict->ma_version_tag = new_version; Py_DECREF(owner); - #line 2571 "Python/generated_cases.c.h" + #line 2570 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2578,7 +2577,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 1856 "Python/bytecodes.c" + #line 1855 "Python/bytecodes.c" PyTypeObject *tp = Py_TYPE(owner); assert(type_version != 0); DEOPT_IF(tp->tp_version_tag != type_version, STORE_ATTR); @@ -2588,7 +2587,7 @@ *(PyObject **)addr = value; Py_XDECREF(old_value); Py_DECREF(owner); - #line 2592 "Python/generated_cases.c.h" + #line 2591 "Python/generated_cases.c.h" STACK_SHRINK(2); next_instr += 4; DISPATCH(); @@ -2600,7 +2599,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1875 "Python/bytecodes.c" + #line 1874 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -2613,12 +2612,12 @@ #endif /* ENABLE_SPECIALIZATION */ assert((oparg >> 4) <= Py_GE); res = PyObject_RichCompare(left, right, oparg>>4); - #line 2617 "Python/generated_cases.c.h" + #line 2616 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1888 "Python/bytecodes.c" + #line 1887 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2622 "Python/generated_cases.c.h" + #line 2621 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2629,7 +2628,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1892 "Python/bytecodes.c" + #line 1891 "Python/bytecodes.c" DEOPT_IF(!PyFloat_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyFloat_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2641,7 +2640,7 @@ _Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2645 "Python/generated_cases.c.h" + #line 2644 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2652,7 +2651,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1907 "Python/bytecodes.c" + #line 1906 "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); @@ -2668,7 +2667,7 @@ _Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free); res = (sign_ish & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2672 "Python/generated_cases.c.h" + #line 2671 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2679,7 +2678,7 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *res; - #line 1926 "Python/bytecodes.c" + #line 1925 "Python/bytecodes.c" DEOPT_IF(!PyUnicode_CheckExact(left), COMPARE_OP); DEOPT_IF(!PyUnicode_CheckExact(right), COMPARE_OP); STAT_INC(COMPARE_OP, hit); @@ -2692,7 +2691,7 @@ assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS); res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False; Py_INCREF(res); - #line 2696 "Python/generated_cases.c.h" + #line 2695 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -2703,14 +2702,14 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1941 "Python/bytecodes.c" + #line 1940 "Python/bytecodes.c" int res = Py_Is(left, right) ^ oparg; - #line 2709 "Python/generated_cases.c.h" + #line 2708 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1943 "Python/bytecodes.c" + #line 1942 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2714 "Python/generated_cases.c.h" + #line 2713 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2720,15 +2719,15 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1947 "Python/bytecodes.c" + #line 1946 "Python/bytecodes.c" int res = PySequence_Contains(right, left); - #line 2726 "Python/generated_cases.c.h" + #line 2725 "Python/generated_cases.c.h" Py_DECREF(left); Py_DECREF(right); - #line 1949 "Python/bytecodes.c" + #line 1948 "Python/bytecodes.c" if (res < 0) goto pop_2_error; b = Py_NewRef((res^oparg) ? Py_True : Py_False); - #line 2732 "Python/generated_cases.c.h" + #line 2731 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = b; DISPATCH(); @@ -2739,12 +2738,12 @@ PyObject *exc_value = stack_pointer[-2]; PyObject *rest; PyObject *match; - #line 1954 "Python/bytecodes.c" + #line 1953 "Python/bytecodes.c" if (check_except_star_type_valid(tstate, match_type) < 0) { - #line 2745 "Python/generated_cases.c.h" + #line 2744 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1956 "Python/bytecodes.c" + #line 1955 "Python/bytecodes.c" if (true) goto pop_2_error; } @@ -2752,10 +2751,10 @@ rest = NULL; int res = exception_group_match(exc_value, match_type, &match, &rest); - #line 2756 "Python/generated_cases.c.h" + #line 2755 "Python/generated_cases.c.h" Py_DECREF(exc_value); Py_DECREF(match_type); - #line 1964 "Python/bytecodes.c" + #line 1963 "Python/bytecodes.c" if (res < 0) goto pop_2_error; assert((match == NULL) == (rest == NULL)); @@ -2764,7 +2763,7 @@ if (!Py_IsNone(match)) { PyErr_SetHandledException(match); } - #line 2768 "Python/generated_cases.c.h" + #line 2767 "Python/generated_cases.c.h" stack_pointer[-1] = match; stack_pointer[-2] = rest; DISPATCH(); @@ -2774,21 +2773,21 @@ PyObject *right = stack_pointer[-1]; PyObject *left = stack_pointer[-2]; PyObject *b; - #line 1975 "Python/bytecodes.c" + #line 1974 "Python/bytecodes.c" assert(PyExceptionInstance_Check(left)); if (check_except_type_valid(tstate, right) < 0) { - #line 2781 "Python/generated_cases.c.h" + #line 2780 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1978 "Python/bytecodes.c" + #line 1977 "Python/bytecodes.c" if (true) goto pop_1_error; } int res = PyErr_GivenExceptionMatches(left, right); - #line 2788 "Python/generated_cases.c.h" + #line 2787 "Python/generated_cases.c.h" Py_DECREF(right); - #line 1983 "Python/bytecodes.c" + #line 1982 "Python/bytecodes.c" b = Py_NewRef(res ? Py_True : Py_False); - #line 2792 "Python/generated_cases.c.h" + #line 2791 "Python/generated_cases.c.h" stack_pointer[-1] = b; DISPATCH(); } @@ -2797,15 +2796,15 @@ PyObject *fromlist = stack_pointer[-1]; PyObject *level = stack_pointer[-2]; PyObject *res; - #line 1987 "Python/bytecodes.c" + #line 1986 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_name(tstate, frame, name, fromlist, level); - #line 2804 "Python/generated_cases.c.h" + #line 2803 "Python/generated_cases.c.h" Py_DECREF(level); Py_DECREF(fromlist); - #line 1990 "Python/bytecodes.c" + #line 1989 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 2809 "Python/generated_cases.c.h" + #line 2808 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; DISPATCH(); @@ -2814,29 +2813,29 @@ TARGET(IMPORT_FROM) { PyObject *from = stack_pointer[-1]; PyObject *res; - #line 1994 "Python/bytecodes.c" + #line 1993 "Python/bytecodes.c" PyObject *name = GETITEM(frame->f_code->co_names, oparg); res = import_from(tstate, from, name); if (res == NULL) goto error; - #line 2822 "Python/generated_cases.c.h" + #line 2821 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); } TARGET(JUMP_FORWARD) { - #line 2000 "Python/bytecodes.c" + #line 1999 "Python/bytecodes.c" JUMPBY(oparg); - #line 2831 "Python/generated_cases.c.h" + #line 2830 "Python/generated_cases.c.h" DISPATCH(); } TARGET(JUMP_BACKWARD) { PREDICTED(JUMP_BACKWARD); - #line 2004 "Python/bytecodes.c" + #line 2003 "Python/bytecodes.c" assert(oparg < INSTR_OFFSET()); JUMPBY(-oparg); - #line 2840 "Python/generated_cases.c.h" + #line 2839 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } @@ -2844,7 +2843,7 @@ TARGET(POP_JUMP_IF_FALSE) { PREDICTED(POP_JUMP_IF_FALSE); PyObject *cond = stack_pointer[-1]; - #line 2010 "Python/bytecodes.c" + #line 2009 "Python/bytecodes.c" if (Py_IsTrue(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2854,9 +2853,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2858 "Python/generated_cases.c.h" + #line 2857 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2020 "Python/bytecodes.c" + #line 2019 "Python/bytecodes.c" if (err == 0) { JUMPBY(oparg); } @@ -2864,14 +2863,14 @@ if (err < 0) goto pop_1_error; } } - #line 2868 "Python/generated_cases.c.h" + #line 2867 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_TRUE) { PyObject *cond = stack_pointer[-1]; - #line 2030 "Python/bytecodes.c" + #line 2029 "Python/bytecodes.c" if (Py_IsFalse(cond)) { _Py_DECREF_NO_DEALLOC(cond); } @@ -2881,9 +2880,9 @@ } else { int err = PyObject_IsTrue(cond); - #line 2885 "Python/generated_cases.c.h" + #line 2884 "Python/generated_cases.c.h" Py_DECREF(cond); - #line 2040 "Python/bytecodes.c" + #line 2039 "Python/bytecodes.c" if (err > 0) { JUMPBY(oparg); } @@ -2891,67 +2890,67 @@ if (err < 0) goto pop_1_error; } } - #line 2895 "Python/generated_cases.c.h" + #line 2894 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NOT_NONE) { PyObject *value = stack_pointer[-1]; - #line 2050 "Python/bytecodes.c" + #line 2049 "Python/bytecodes.c" if (!Py_IsNone(value)) { - #line 2904 "Python/generated_cases.c.h" + #line 2903 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2052 "Python/bytecodes.c" + #line 2051 "Python/bytecodes.c" JUMPBY(oparg); } else { _Py_DECREF_NO_DEALLOC(value); } - #line 2912 "Python/generated_cases.c.h" + #line 2911 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(POP_JUMP_IF_NONE) { PyObject *value = stack_pointer[-1]; - #line 2060 "Python/bytecodes.c" + #line 2059 "Python/bytecodes.c" if (Py_IsNone(value)) { _Py_DECREF_NO_DEALLOC(value); JUMPBY(oparg); } else { - #line 2925 "Python/generated_cases.c.h" + #line 2924 "Python/generated_cases.c.h" Py_DECREF(value); - #line 2066 "Python/bytecodes.c" + #line 2065 "Python/bytecodes.c" } - #line 2929 "Python/generated_cases.c.h" + #line 2928 "Python/generated_cases.c.h" STACK_SHRINK(1); DISPATCH(); } TARGET(JUMP_BACKWARD_NO_INTERRUPT) { - #line 2070 "Python/bytecodes.c" + #line 2069 "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. * (see bpo-30039). */ JUMPBY(-oparg); - #line 2942 "Python/generated_cases.c.h" + #line 2941 "Python/generated_cases.c.h" DISPATCH(); } TARGET(GET_LEN) { PyObject *obj = stack_pointer[-1]; PyObject *len_o; - #line 2079 "Python/bytecodes.c" + #line 2078 "Python/bytecodes.c" // PUSH(len(TOS)) Py_ssize_t len_i = PyObject_Length(obj); if (len_i < 0) goto error; len_o = PyLong_FromSsize_t(len_i); if (len_o == NULL) goto error; - #line 2955 "Python/generated_cases.c.h" + #line 2954 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = len_o; DISPATCH(); @@ -2962,16 +2961,16 @@ PyObject *type = stack_pointer[-2]; PyObject *subject = stack_pointer[-3]; PyObject *attrs; - #line 2087 "Python/bytecodes.c" + #line 2086 "Python/bytecodes.c" // Pop TOS and TOS1. Set TOS to a tuple of attributes on success, or // None on failure. assert(PyTuple_CheckExact(names)); attrs = match_class(tstate, subject, type, oparg, names); - #line 2971 "Python/generated_cases.c.h" + #line 2970 "Python/generated_cases.c.h" Py_DECREF(subject); Py_DECREF(type); Py_DECREF(names); - #line 2092 "Python/bytecodes.c" + #line 2091 "Python/bytecodes.c" if (attrs) { assert(PyTuple_CheckExact(attrs)); // Success! } @@ -2979,7 +2978,7 @@ if (_PyErr_Occurred(tstate)) goto pop_3_error; attrs = Py_NewRef(Py_None); // Failure! } - #line 2983 "Python/generated_cases.c.h" + #line 2982 "Python/generated_cases.c.h" STACK_SHRINK(2); stack_pointer[-1] = attrs; DISPATCH(); @@ -2988,10 +2987,10 @@ TARGET(MATCH_MAPPING) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2102 "Python/bytecodes.c" + #line 2101 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_MAPPING; res = Py_NewRef(match ? Py_True : Py_False); - #line 2995 "Python/generated_cases.c.h" + #line 2994 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3001,10 +3000,10 @@ TARGET(MATCH_SEQUENCE) { PyObject *subject = stack_pointer[-1]; PyObject *res; - #line 2108 "Python/bytecodes.c" + #line 2107 "Python/bytecodes.c" int match = Py_TYPE(subject)->tp_flags & Py_TPFLAGS_SEQUENCE; res = Py_NewRef(match ? Py_True : Py_False); - #line 3008 "Python/generated_cases.c.h" + #line 3007 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; PREDICT(POP_JUMP_IF_FALSE); @@ -3015,11 +3014,11 @@ PyObject *keys = stack_pointer[-1]; PyObject *subject = stack_pointer[-2]; PyObject *values_or_none; - #line 2114 "Python/bytecodes.c" + #line 2113 "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; - #line 3023 "Python/generated_cases.c.h" + #line 3022 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = values_or_none; DISPATCH(); @@ -3028,14 +3027,14 @@ TARGET(GET_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2120 "Python/bytecodes.c" + #line 2119 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ iter = PyObject_GetIter(iterable); - #line 3035 "Python/generated_cases.c.h" + #line 3034 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2123 "Python/bytecodes.c" + #line 2122 "Python/bytecodes.c" if (iter == NULL) goto pop_1_error; - #line 3039 "Python/generated_cases.c.h" + #line 3038 "Python/generated_cases.c.h" stack_pointer[-1] = iter; DISPATCH(); } @@ -3043,7 +3042,7 @@ TARGET(GET_YIELD_FROM_ITER) { PyObject *iterable = stack_pointer[-1]; PyObject *iter; - #line 2127 "Python/bytecodes.c" + #line 2126 "Python/bytecodes.c" /* before: [obj]; after [getiter(obj)] */ if (PyCoro_CheckExact(iterable)) { /* `iterable` is a coroutine */ @@ -3066,11 +3065,11 @@ if (iter == NULL) { goto error; } - #line 3070 "Python/generated_cases.c.h" + #line 3069 "Python/generated_cases.c.h" Py_DECREF(iterable); - #line 2150 "Python/bytecodes.c" + #line 2149 "Python/bytecodes.c" } - #line 3074 "Python/generated_cases.c.h" + #line 3073 "Python/generated_cases.c.h" stack_pointer[-1] = iter; PREDICT(LOAD_CONST); DISPATCH(); @@ -3081,7 +3080,7 @@ static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size"); PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2169 "Python/bytecodes.c" + #line 2168 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyForIterCache *cache = (_PyForIterCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -3112,7 +3111,7 @@ DISPATCH(); } // Common case: no jump, leave it to the code generator - #line 3116 "Python/generated_cases.c.h" + #line 3115 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3120,7 +3119,7 @@ } TARGET(INSTRUMENTED_FOR_ITER) { - #line 2202 "Python/bytecodes.c" + #line 2201 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _Py_CODEUNIT *target; PyObject *iter = TOP(); @@ -3146,14 +3145,14 @@ target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1; } INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH); - #line 3150 "Python/generated_cases.c.h" + #line 3149 "Python/generated_cases.c.h" DISPATCH(); } TARGET(FOR_ITER_LIST) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2230 "Python/bytecodes.c" + #line 2229 "Python/bytecodes.c" DEOPT_IF(Py_TYPE(iter) != &PyListIter_Type, FOR_ITER); _PyListIterObject *it = (_PyListIterObject *)iter; STAT_INC(FOR_ITER, hit); @@ -3173,7 +3172,7 @@ DISPATCH(); end_for_iter_list: // Common case: no jump, leave it to the code generator - #line 3177 "Python/generated_cases.c.h" + #line 3176 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3183,7 +3182,7 @@ TARGET(FOR_ITER_TUPLE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2252 "Python/bytecodes.c" + #line 2251 "Python/bytecodes.c" _PyTupleIterObject *it = (_PyTupleIterObject *)iter; DEOPT_IF(Py_TYPE(it) != &PyTupleIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3203,7 +3202,7 @@ DISPATCH(); end_for_iter_tuple: // Common case: no jump, leave it to the code generator - #line 3207 "Python/generated_cases.c.h" + #line 3206 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3213,7 +3212,7 @@ TARGET(FOR_ITER_RANGE) { PyObject *iter = stack_pointer[-1]; PyObject *next; - #line 2274 "Python/bytecodes.c" + #line 2273 "Python/bytecodes.c" _PyRangeIterObject *r = (_PyRangeIterObject *)iter; DEOPT_IF(Py_TYPE(r) != &PyRangeIter_Type, FOR_ITER); STAT_INC(FOR_ITER, hit); @@ -3231,7 +3230,7 @@ if (next == NULL) { goto error; } - #line 3235 "Python/generated_cases.c.h" + #line 3234 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = next; next_instr += 1; @@ -3240,7 +3239,7 @@ TARGET(FOR_ITER_GEN) { PyObject *iter = stack_pointer[-1]; - #line 2294 "Python/bytecodes.c" + #line 2293 "Python/bytecodes.c" PyGenObject *gen = (PyGenObject *)iter; DEOPT_IF(Py_TYPE(gen) != &PyGen_Type, FOR_ITER); DEOPT_IF(gen->gi_frame_state >= FRAME_EXECUTING, FOR_ITER); @@ -3255,14 +3254,14 @@ assert(next_instr[oparg].op.code == END_FOR || next_instr[oparg].op.code == INSTRUMENTED_END_FOR); DISPATCH_INLINED(gen_frame); - #line 3259 "Python/generated_cases.c.h" + #line 3258 "Python/generated_cases.c.h" } TARGET(BEFORE_ASYNC_WITH) { PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2311 "Python/bytecodes.c" + #line 2310 "Python/bytecodes.c" PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__)); if (enter == NULL) { if (!_PyErr_Occurred(tstate)) { @@ -3285,16 +3284,16 @@ Py_DECREF(enter); goto error; } - #line 3289 "Python/generated_cases.c.h" + #line 3288 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2334 "Python/bytecodes.c" + #line 2333 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3298 "Python/generated_cases.c.h" + #line 3297 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3306,7 +3305,7 @@ PyObject *mgr = stack_pointer[-1]; PyObject *exit; PyObject *res; - #line 2344 "Python/bytecodes.c" + #line 2343 "Python/bytecodes.c" /* pop the context manager, push its __exit__ and the * value returned from calling its __enter__ */ @@ -3332,16 +3331,16 @@ Py_DECREF(enter); goto error; } - #line 3336 "Python/generated_cases.c.h" + #line 3335 "Python/generated_cases.c.h" Py_DECREF(mgr); - #line 2370 "Python/bytecodes.c" + #line 2369 "Python/bytecodes.c" res = _PyObject_CallNoArgs(enter); Py_DECREF(enter); if (res == NULL) { Py_DECREF(exit); if (true) goto pop_1_error; } - #line 3345 "Python/generated_cases.c.h" + #line 3344 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; stack_pointer[-2] = exit; @@ -3353,7 +3352,7 @@ PyObject *lasti = stack_pointer[-3]; PyObject *exit_func = stack_pointer[-4]; PyObject *res; - #line 2379 "Python/bytecodes.c" + #line 2378 "Python/bytecodes.c" /* At the top of the stack are 4 values: - val: TOP = exc_info() - unused: SECOND = previous exception @@ -3374,7 +3373,7 @@ res = PyObject_Vectorcall(exit_func, stack + 1, 3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); if (res == NULL) goto error; - #line 3378 "Python/generated_cases.c.h" + #line 3377 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = res; DISPATCH(); @@ -3383,7 +3382,7 @@ TARGET(PUSH_EXC_INFO) { PyObject *new_exc = stack_pointer[-1]; PyObject *prev_exc; - #line 2402 "Python/bytecodes.c" + #line 2401 "Python/bytecodes.c" _PyErr_StackItem *exc_info = tstate->exc_info; if (exc_info->exc_value != NULL) { prev_exc = exc_info->exc_value; @@ -3393,7 +3392,7 @@ } assert(PyExceptionInstance_Check(new_exc)); exc_info->exc_value = Py_NewRef(new_exc); - #line 3397 "Python/generated_cases.c.h" + #line 3396 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = new_exc; stack_pointer[-2] = prev_exc; @@ -3407,7 +3406,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 2414 "Python/bytecodes.c" + #line 2413 "Python/bytecodes.c" /* Cached method object */ PyTypeObject *self_cls = Py_TYPE(self); assert(type_version != 0); @@ -3424,7 +3423,7 @@ assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR)); res = self; assert(oparg & 1); - #line 3428 "Python/generated_cases.c.h" + #line 3427 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3438,7 +3437,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2433 "Python/bytecodes.c" + #line 2432 "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); @@ -3448,7 +3447,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3452 "Python/generated_cases.c.h" + #line 3451 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3462,7 +3461,7 @@ PyObject *res; uint32_t type_version = read_u32(&next_instr[1].cache); PyObject *descr = read_obj(&next_instr[5].cache); - #line 2445 "Python/bytecodes.c" + #line 2444 "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; @@ -3476,7 +3475,7 @@ res2 = Py_NewRef(descr); res = self; assert(oparg & 1); - #line 3480 "Python/generated_cases.c.h" + #line 3479 "Python/generated_cases.c.h" STACK_GROW(((oparg & 1) ? 1 : 0)); stack_pointer[-1] = res; if (oparg & 1) { stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))] = res2; } @@ -3485,16 +3484,16 @@ } TARGET(KW_NAMES) { - #line 2461 "Python/bytecodes.c" + #line 2460 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg < PyTuple_GET_SIZE(frame->f_code->co_consts)); kwnames = GETITEM(frame->f_code->co_consts, oparg); - #line 3493 "Python/generated_cases.c.h" + #line 3492 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_CALL) { - #line 2467 "Python/bytecodes.c" + #line 2466 "Python/bytecodes.c" int is_meth = PEEK(oparg+2) != NULL; int total_args = oparg + is_meth; PyObject *function = PEEK(total_args + 1); @@ -3507,7 +3506,7 @@ _PyCallCache *cache = (_PyCallCache *)next_instr; INCREMENT_ADAPTIVE_COUNTER(cache->counter); GO_TO_INSTRUCTION(CALL); - #line 3511 "Python/generated_cases.c.h" + #line 3510 "Python/generated_cases.c.h" } TARGET(CALL) { @@ -3517,7 +3516,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2512 "Python/bytecodes.c" + #line 2511 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3599,7 +3598,7 @@ Py_DECREF(args[i]); } if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3603 "Python/generated_cases.c.h" + #line 3602 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3611,7 +3610,7 @@ TARGET(CALL_BOUND_METHOD_EXACT_ARGS) { PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2600 "Python/bytecodes.c" + #line 2599 "Python/bytecodes.c" DEOPT_IF(method != NULL, CALL); DEOPT_IF(Py_TYPE(callable) != &PyMethod_Type, CALL); STAT_INC(CALL, hit); @@ -3621,7 +3620,7 @@ PEEK(oparg + 2) = Py_NewRef(meth); // method Py_DECREF(callable); GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS); - #line 3625 "Python/generated_cases.c.h" + #line 3624 "Python/generated_cases.c.h" } TARGET(CALL_PY_EXACT_ARGS) { @@ -3630,7 +3629,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2612 "Python/bytecodes.c" + #line 2611 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3656,7 +3655,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3660 "Python/generated_cases.c.h" + #line 3659 "Python/generated_cases.c.h" } TARGET(CALL_PY_WITH_DEFAULTS) { @@ -3664,7 +3663,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; uint32_t func_version = read_u32(&next_instr[1].cache); - #line 2640 "Python/bytecodes.c" + #line 2639 "Python/bytecodes.c" assert(kwnames == NULL); DEOPT_IF(tstate->interp->eval_frame, CALL); int is_meth = method != NULL; @@ -3700,7 +3699,7 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL); frame->return_offset = 0; DISPATCH_INLINED(new_frame); - #line 3704 "Python/generated_cases.c.h" + #line 3703 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_TYPE_1) { @@ -3708,7 +3707,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2678 "Python/bytecodes.c" + #line 2677 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3718,7 +3717,7 @@ res = Py_NewRef(Py_TYPE(obj)); Py_DECREF(obj); Py_DECREF(&PyType_Type); // I.e., callable - #line 3722 "Python/generated_cases.c.h" + #line 3721 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3731,7 +3730,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2690 "Python/bytecodes.c" + #line 2689 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3742,7 +3741,7 @@ Py_DECREF(arg); Py_DECREF(&PyUnicode_Type); // I.e., callable if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3746 "Python/generated_cases.c.h" + #line 3745 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3756,7 +3755,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *null = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2704 "Python/bytecodes.c" + #line 2703 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); DEOPT_IF(null != NULL, CALL); @@ -3767,7 +3766,7 @@ Py_DECREF(arg); Py_DECREF(&PyTuple_Type); // I.e., tuple if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3771 "Python/generated_cases.c.h" + #line 3770 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3781,7 +3780,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2718 "Python/bytecodes.c" + #line 2717 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -3803,7 +3802,7 @@ } Py_DECREF(tp); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3807 "Python/generated_cases.c.h" + #line 3806 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3817,7 +3816,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2743 "Python/bytecodes.c" + #line 2742 "Python/bytecodes.c" /* Builtin METH_O functions */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3845,7 +3844,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3849 "Python/generated_cases.c.h" + #line 3848 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3859,7 +3858,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2774 "Python/bytecodes.c" + #line 2773 "Python/bytecodes.c" /* Builtin METH_FASTCALL functions, without keywords */ assert(kwnames == NULL); int is_meth = method != NULL; @@ -3891,7 +3890,7 @@ 'invalid'). In those cases an exception is set, so we must handle it. */ - #line 3895 "Python/generated_cases.c.h" + #line 3894 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3905,7 +3904,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2809 "Python/bytecodes.c" + #line 2808 "Python/bytecodes.c" /* Builtin METH_FASTCALL | METH_KEYWORDS functions */ int is_meth = method != NULL; int total_args = oparg; @@ -3937,7 +3936,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3941 "Python/generated_cases.c.h" + #line 3940 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3951,7 +3950,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2844 "Python/bytecodes.c" + #line 2843 "Python/bytecodes.c" assert(kwnames == NULL); /* len(o) */ int is_meth = method != NULL; @@ -3976,7 +3975,7 @@ Py_DECREF(callable); Py_DECREF(arg); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 3980 "Python/generated_cases.c.h" + #line 3979 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -3989,7 +3988,7 @@ PyObject *callable = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2871 "Python/bytecodes.c" + #line 2870 "Python/bytecodes.c" assert(kwnames == NULL); /* isinstance(o, o2) */ int is_meth = method != NULL; @@ -4016,7 +4015,7 @@ Py_DECREF(cls); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4020 "Python/generated_cases.c.h" + #line 4019 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4028,7 +4027,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *self = stack_pointer[-(1 + oparg)]; PyObject *method = stack_pointer[-(2 + oparg)]; - #line 2901 "Python/bytecodes.c" + #line 2900 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 1); assert(method != NULL); @@ -4046,14 +4045,14 @@ JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1); assert(next_instr[-1].op.code == POP_TOP); DISPATCH(); - #line 4050 "Python/generated_cases.c.h" + #line 4049 "Python/generated_cases.c.h" } TARGET(CALL_NO_KW_METHOD_DESCRIPTOR_O) { PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2921 "Python/bytecodes.c" + #line 2920 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4084,7 +4083,7 @@ Py_DECREF(arg); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4088 "Python/generated_cases.c.h" + #line 4087 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4097,7 +4096,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2955 "Python/bytecodes.c" + #line 2954 "Python/bytecodes.c" int is_meth = method != NULL; int total_args = oparg; if (is_meth) { @@ -4126,7 +4125,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4130 "Python/generated_cases.c.h" + #line 4129 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4139,7 +4138,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 2987 "Python/bytecodes.c" + #line 2986 "Python/bytecodes.c" assert(kwnames == NULL); assert(oparg == 0 || oparg == 1); int is_meth = method != NULL; @@ -4168,7 +4167,7 @@ Py_DECREF(self); Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4172 "Python/generated_cases.c.h" + #line 4171 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4181,7 +4180,7 @@ PyObject **args = (stack_pointer - oparg); PyObject *method = stack_pointer[-(2 + oparg)]; PyObject *res; - #line 3019 "Python/bytecodes.c" + #line 3018 "Python/bytecodes.c" assert(kwnames == NULL); int is_meth = method != NULL; int total_args = oparg; @@ -4209,7 +4208,7 @@ } Py_DECREF(callable); if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; } - #line 4213 "Python/generated_cases.c.h" + #line 4212 "Python/generated_cases.c.h" STACK_SHRINK(oparg); STACK_SHRINK(1); stack_pointer[-1] = res; @@ -4219,9 +4218,9 @@ } TARGET(INSTRUMENTED_CALL_FUNCTION_EX) { - #line 3050 "Python/bytecodes.c" + #line 3049 "Python/bytecodes.c" GO_TO_INSTRUCTION(CALL_FUNCTION_EX); - #line 4225 "Python/generated_cases.c.h" + #line 4224 "Python/generated_cases.c.h" } TARGET(CALL_FUNCTION_EX) { @@ -4230,7 +4229,7 @@ PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))]; PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))]; PyObject *result; - #line 3054 "Python/bytecodes.c" + #line 3053 "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)); @@ -4273,14 +4272,14 @@ else { result = PyObject_Call(func, callargs, kwargs); } - #line 4277 "Python/generated_cases.c.h" + #line 4276 "Python/generated_cases.c.h" Py_DECREF(func); Py_DECREF(callargs); Py_XDECREF(kwargs); - #line 3097 "Python/bytecodes.c" + #line 3096 "Python/bytecodes.c" assert(PEEK(3 + (oparg & 1)) == NULL); if (result == NULL) { STACK_SHRINK(((oparg & 1) ? 1 : 0)); goto pop_3_error; } - #line 4284 "Python/generated_cases.c.h" + #line 4283 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 1) ? 1 : 0)); STACK_SHRINK(2); stack_pointer[-1] = result; @@ -4295,7 +4294,7 @@ PyObject *kwdefaults = (oparg & 0x02) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0))] : NULL; PyObject *defaults = (oparg & 0x01) ? stack_pointer[-(1 + ((oparg & 0x08) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x01) ? 1 : 0))] : NULL; PyObject *func; - #line 3107 "Python/bytecodes.c" + #line 3106 "Python/bytecodes.c" PyFunctionObject *func_obj = (PyFunctionObject *) PyFunction_New(codeobj, GLOBALS()); @@ -4324,14 +4323,14 @@ func_obj->func_version = ((PyCodeObject *)codeobj)->co_version; func = (PyObject *)func_obj; - #line 4328 "Python/generated_cases.c.h" + #line 4327 "Python/generated_cases.c.h" STACK_SHRINK(((oparg & 0x01) ? 1 : 0) + ((oparg & 0x02) ? 1 : 0) + ((oparg & 0x04) ? 1 : 0) + ((oparg & 0x08) ? 1 : 0)); stack_pointer[-1] = func; DISPATCH(); } TARGET(RETURN_GENERATOR) { - #line 3138 "Python/bytecodes.c" + #line 3137 "Python/bytecodes.c" assert(PyFunction_Check(frame->f_funcobj)); PyFunctionObject *func = (PyFunctionObject *)frame->f_funcobj; PyGenObject *gen = (PyGenObject *)_Py_MakeCoro(func); @@ -4352,7 +4351,7 @@ frame = cframe.current_frame = prev; _PyFrame_StackPush(frame, (PyObject *)gen); goto resume_frame; - #line 4356 "Python/generated_cases.c.h" + #line 4355 "Python/generated_cases.c.h" } TARGET(BUILD_SLICE) { @@ -4360,15 +4359,15 @@ PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))]; PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))]; PyObject *slice; - #line 3161 "Python/bytecodes.c" + #line 3160 "Python/bytecodes.c" slice = PySlice_New(start, stop, step); - #line 4366 "Python/generated_cases.c.h" + #line 4365 "Python/generated_cases.c.h" Py_DECREF(start); Py_DECREF(stop); Py_XDECREF(step); - #line 3163 "Python/bytecodes.c" + #line 3162 "Python/bytecodes.c" if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; } - #line 4372 "Python/generated_cases.c.h" + #line 4371 "Python/generated_cases.c.h" STACK_SHRINK(((oparg == 3) ? 1 : 0)); STACK_SHRINK(1); stack_pointer[-1] = slice; @@ -4379,7 +4378,7 @@ 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))]; PyObject *result; - #line 3167 "Python/bytecodes.c" + #line 3166 "Python/bytecodes.c" /* Handles f-string value formatting. */ PyObject *(*conv_fn)(PyObject *); int which_conversion = oparg & FVC_MASK; @@ -4414,7 +4413,7 @@ 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 4418 "Python/generated_cases.c.h" + #line 4417 "Python/generated_cases.c.h" STACK_SHRINK((((oparg & FVS_MASK) == FVS_HAVE_SPEC) ? 1 : 0)); stack_pointer[-1] = result; DISPATCH(); @@ -4423,10 +4422,10 @@ TARGET(COPY) { PyObject *bottom = stack_pointer[-(1 + (oparg-1))]; PyObject *top; - #line 3204 "Python/bytecodes.c" + #line 3203 "Python/bytecodes.c" assert(oparg > 0); top = Py_NewRef(bottom); - #line 4430 "Python/generated_cases.c.h" + #line 4429 "Python/generated_cases.c.h" STACK_GROW(1); stack_pointer[-1] = top; DISPATCH(); @@ -4438,7 +4437,7 @@ PyObject *rhs = stack_pointer[-1]; PyObject *lhs = stack_pointer[-2]; PyObject *res; - #line 3209 "Python/bytecodes.c" + #line 3208 "Python/bytecodes.c" #if ENABLE_SPECIALIZATION _PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr; if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) { @@ -4453,12 +4452,12 @@ assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops)); assert(binary_ops[oparg]); res = binary_ops[oparg](lhs, rhs); - #line 4457 "Python/generated_cases.c.h" + #line 4456 "Python/generated_cases.c.h" Py_DECREF(lhs); Py_DECREF(rhs); - #line 3224 "Python/bytecodes.c" + #line 3223 "Python/bytecodes.c" if (res == NULL) goto pop_2_error; - #line 4462 "Python/generated_cases.c.h" + #line 4461 "Python/generated_cases.c.h" STACK_SHRINK(1); stack_pointer[-1] = res; next_instr += 1; @@ -4468,16 +4467,16 @@ TARGET(SWAP) { PyObject *top = stack_pointer[-1]; PyObject *bottom = stack_pointer[-(2 + (oparg-2))]; - #line 3229 "Python/bytecodes.c" + #line 3228 "Python/bytecodes.c" assert(oparg >= 2); - #line 4474 "Python/generated_cases.c.h" + #line 4473 "Python/generated_cases.c.h" stack_pointer[-1] = bottom; stack_pointer[-(2 + (oparg-2))] = top; DISPATCH(); } TARGET(INSTRUMENTED_LINE) { - #line 3233 "Python/bytecodes.c" + #line 3232 "Python/bytecodes.c" _Py_CODEUNIT *here = next_instr-1; _PyFrame_SetStackPointer(frame, stack_pointer); int original_opcode = _Py_call_instrumentation_line( @@ -4497,11 +4496,11 @@ } opcode = original_opcode; DISPATCH_GOTO(); - #line 4501 "Python/generated_cases.c.h" + #line 4500 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_INSTRUCTION) { - #line 3255 "Python/bytecodes.c" + #line 3254 "Python/bytecodes.c" int next_opcode = _Py_call_instrumentation_instruction( tstate, frame, next_instr-1); if (next_opcode < 0) goto error; @@ -4513,26 +4512,26 @@ assert(next_opcode > 0 && next_opcode < 256); opcode = next_opcode; DISPATCH_GOTO(); - #line 4517 "Python/generated_cases.c.h" + #line 4516 "Python/generated_cases.c.h" } TARGET(INSTRUMENTED_JUMP_FORWARD) { - #line 3269 "Python/bytecodes.c" + #line 3268 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP); - #line 4523 "Python/generated_cases.c.h" + #line 4522 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_JUMP_BACKWARD) { - #line 3273 "Python/bytecodes.c" + #line 3272 "Python/bytecodes.c" INSTRUMENTED_JUMP(next_instr-1, next_instr-oparg, PY_MONITORING_EVENT_JUMP); - #line 4530 "Python/generated_cases.c.h" + #line 4529 "Python/generated_cases.c.h" CHECK_EVAL_BREAKER(); DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) { - #line 3278 "Python/bytecodes.c" + #line 3277 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4541,12 +4540,12 @@ assert(err == 0 || err == 1); int offset = err*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4545 "Python/generated_cases.c.h" + #line 4544 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) { - #line 3289 "Python/bytecodes.c" + #line 3288 "Python/bytecodes.c" PyObject *cond = POP(); int err = PyObject_IsTrue(cond); Py_DECREF(cond); @@ -4555,12 +4554,12 @@ assert(err == 0 || err == 1); int offset = (1-err)*oparg; INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4559 "Python/generated_cases.c.h" + #line 4558 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) { - #line 3300 "Python/bytecodes.c" + #line 3299 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4573,12 +4572,12 @@ offset = 0; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4577 "Python/generated_cases.c.h" + #line 4576 "Python/generated_cases.c.h" DISPATCH(); } TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) { - #line 3315 "Python/bytecodes.c" + #line 3314 "Python/bytecodes.c" PyObject *value = POP(); _Py_CODEUNIT *here = next_instr-1; int offset; @@ -4591,30 +4590,30 @@ offset = oparg; } INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH); - #line 4595 "Python/generated_cases.c.h" + #line 4594 "Python/generated_cases.c.h" DISPATCH(); } TARGET(EXTENDED_ARG) { - #line 3330 "Python/bytecodes.c" + #line 3329 "Python/bytecodes.c" assert(oparg); opcode = next_instr->op.code; oparg = oparg << 8 | next_instr->op.arg; PRE_DISPATCH_GOTO(); DISPATCH_GOTO(); - #line 4606 "Python/generated_cases.c.h" + #line 4605 "Python/generated_cases.c.h" } TARGET(CACHE) { - #line 3338 "Python/bytecodes.c" + #line 3337 "Python/bytecodes.c" assert(0 && "Executing a cache."); Py_UNREACHABLE(); - #line 4613 "Python/generated_cases.c.h" + #line 4612 "Python/generated_cases.c.h" } TARGET(RESERVED) { - #line 3343 "Python/bytecodes.c" + #line 3342 "Python/bytecodes.c" assert(0 && "Executing RESERVED instruction."); Py_UNREACHABLE(); - #line 4620 "Python/generated_cases.c.h" + #line 4619 "Python/generated_cases.c.h" } From df442c0deb2f3dec8bfbd01fd97a5e00080b4096 Mon Sep 17 00:00:00 2001 From: Carl Meyer Date: Wed, 19 Apr 2023 21:14:48 -0700 Subject: [PATCH 16/16] move __class__ special case out of the fast path --- Lib/test/test_super.py | 17 +++++++++++++++++ Objects/typeobject.c | 15 ++++++++------- Python/compile.c | 10 ++++++---- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/Lib/test/test_super.py b/Lib/test/test_super.py index 2cdfd342f320f1..ed773a3cff2a6d 100644 --- a/Lib/test/test_super.py +++ b/Lib/test/test_super.py @@ -393,6 +393,23 @@ def method(self): with self.assertRaisesRegex(TypeError, "argument 1 must be a type"): C().method() + def test_super___class__(self): + class C: + def method(self): + return super().__class__ + + self.assertEqual(C().method(), super) + + def test_super_subclass___class__(self): + class mysuper(super): + pass + + class C: + def method(self): + return mysuper(C, self).__class__ + + self.assertEqual(C().method(), mysuper) + if __name__ == "__main__": unittest.main() diff --git a/Objects/typeobject.c b/Objects/typeobject.c index c52437a2c18e3e..fc4de6da8f273b 100644 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -9370,13 +9370,6 @@ do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj, if (su_obj_type == NULL) goto skip; - /* We want __class__ to return the class of the super object - (i.e. super, or a subclass), not the class of su->obj. */ - if (PyUnicode_Check(name) && - PyUnicode_GET_LENGTH(name) == 9 && - _PyUnicode_Equal(name, &_Py_ID(__class__))) - goto skip; - mro = su_obj_type->tp_mro; if (mro == NULL) goto skip; @@ -9452,6 +9445,14 @@ static PyObject * super_getattro(PyObject *self, PyObject *name) { superobject *su = (superobject *)self; + + /* We want __class__ to return the class of the super object + (i.e. super, or a subclass), not the class of su->obj. */ + if (PyUnicode_Check(name) && + PyUnicode_GET_LENGTH(name) == 9 && + _PyUnicode_Equal(name, &_Py_ID(__class__))) + return PyObject_GenericGetAttr(self, name); + return do_super_lookup(su, su->type, su->obj, su->obj_type, name, NULL); } diff --git a/Python/compile.c b/Python/compile.c index a6ef25901973a8..966b28a11d3526 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -4237,18 +4237,20 @@ is_import_originated(struct compiler *c, expr_ty e) } static int -can_optimize_super_call(struct compiler *c, expr_ty e) +can_optimize_super_call(struct compiler *c, expr_ty attr) { + expr_ty e = attr->v.Attribute.value; if (e->kind != Call_kind || e->v.Call.func->kind != Name_kind || !_PyUnicode_EqualToASCIIString(e->v.Call.func->v.Name.id, "super") || + _PyUnicode_EqualToASCIIString(attr->v.Attribute.attr, "__class__") || asdl_seq_LEN(e->v.Call.keywords) != 0) { return 0; } Py_ssize_t num_args = asdl_seq_LEN(e->v.Call.args); PyObject *super_name = e->v.Call.func->v.Name.id; - // try to detect statically-visible shadowing of 'super' name + // detect statically-visible shadowing of 'super' name int scope = _PyST_GetScope(c->u->u_ste, super_name); if (scope != GLOBAL_IMPLICIT) { return 0; @@ -4388,7 +4390,7 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e) /* Alright, we can optimize the code. */ location loc = LOC(meth); - if (can_optimize_super_call(c, meth->v.Attribute.value)) { + if (can_optimize_super_call(c, meth)) { RETURN_IF_ERROR(load_args_for_super(c, meth->v.Attribute.value)); int opcode = asdl_seq_LEN(meth->v.Attribute.value->v.Call.args) ? LOAD_SUPER_METHOD : LOAD_ZERO_SUPER_METHOD; @@ -5406,7 +5408,7 @@ compiler_visit_expr1(struct compiler *c, expr_ty e) return compiler_formatted_value(c, e); /* The following exprs can be assignment targets. */ case Attribute_kind: - if (e->v.Attribute.ctx == Load && can_optimize_super_call(c, e->v.Attribute.value)) { + if (e->v.Attribute.ctx == Load && can_optimize_super_call(c, e)) { RETURN_IF_ERROR(load_args_for_super(c, e->v.Attribute.value)); int opcode = asdl_seq_LEN(e->v.Attribute.value->v.Call.args) ? LOAD_SUPER_ATTR : LOAD_ZERO_SUPER_ATTR;