summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Meyer <carl@oddbird.net>2023-04-24 16:22:14 -0600
committerGitHub <noreply@github.com>2023-04-24 22:22:14 +0000
commit0dc8b50d33208e9ca4fc3d959c6798529731f020 (patch)
tree822102a5177183fc6ad7075bd74a02a5633edc52
parent22bed58e531ce780d91f3364c5ace98fad28c2e8 (diff)
downloadcpython-git-0dc8b50d33208e9ca4fc3d959c6798529731f020.tar.gz
gh-87729: add LOAD_SUPER_ATTR instruction for faster super() (#103497)
This speeds up `super()` (by around 85%, for a simple one-level `super().meth()` microbenchmark) by avoiding allocation of a new single-use `super()` object on each use.
-rw-r--r--Doc/library/dis.rst18
-rw-r--r--Include/internal/pycore_opcode.h15
-rw-r--r--Include/internal/pycore_typeobject.h3
-rw-r--r--Include/opcode.h23
-rw-r--r--Lib/dis.py5
-rw-r--r--Lib/importlib/_bootstrap_external.py5
-rw-r--r--Lib/opcode.py5
-rw-r--r--Lib/test/shadowed_super.py7
-rw-r--r--Lib/test/test_gdb.py2
-rw-r--r--Lib/test/test_super.py91
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-22-03.gh-issue-87729.99A7UO.rst1
-rw-r--r--Objects/typeobject.c93
-rw-r--r--Python/bytecodes.c31
-rw-r--r--Python/ceval.c1
-rw-r--r--Python/compile.c128
-rw-r--r--Python/generated_cases.c.h750
-rw-r--r--Python/opcode_metadata.h5
-rw-r--r--Python/opcode_targets.h8
18 files changed, 783 insertions, 408 deletions
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst
index 19c08b225e..3894837127 100644
--- a/Doc/library/dis.rst
+++ b/Doc/library/dis.rst
@@ -1036,6 +1036,24 @@ iterations of the loop.
pushed to the stack before the attribute or unbound method respectively.
+.. 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 two-argument
+ call to :func:`super` (unset means zero-argument).
+
+ .. versionadded:: 3.12
+
+
.. opcode:: COMPARE_OP (opname)
Performs a Boolean operation. The operation name can be found in
diff --git a/Include/internal/pycore_opcode.h b/Include/internal/pycore_opcode.h
index c039d712dc..529b08fadb 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_SUPER_ATTR] = LOAD_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[266] = {
[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_SUPER_ATTR] = "LOAD_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,13 @@ static const char *const _PyOpcode_OpName[263] = {
[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
#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 cc5ce28751..324e500eaa 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 aa8716ef5b..76e9bc870d 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_SUPER_ATTR 141
#define CALL_FUNCTION_EX 142
#define EXTENDED_ARG 144
#define LIST_APPEND 145
@@ -142,7 +143,10 @@ extern "C" {
#define JUMP 260
#define JUMP_NO_INTERRUPT 261
#define LOAD_METHOD 262
-#define MAX_PSEUDO_OPCODE 262
+#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
@@ -198,18 +202,21 @@ 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_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 6a7fcb8a1a..8af84c00d0 100644
--- a/Lib/dis.py
+++ b/Lib/dis.py
@@ -41,6 +41,7 @@ JUMP_BACKWARD = opmap['JUMP_BACKWARD']
FOR_ITER = opmap['FOR_ITER']
SEND = opmap['SEND']
LOAD_ATTR = opmap['LOAD_ATTR']
+LOAD_SUPER_ATTR = opmap['LOAD_SUPER_ATTR']
CACHE = opmap["CACHE"]
@@ -475,6 +476,10 @@ 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|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/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
index c0c757d94d..74a78bc9f6 100644
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -439,7 +439,8 @@ _code_type = type(_write_atomic.__code__)
# 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 @@ _code_type = type(_write_atomic.__code__)
# 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 dd739e5dd3..e7b346e8ec 100644
--- a/Lib/opcode.py
+++ b/Lib/opcode.py
@@ -196,7 +196,7 @@ hasfree.append(138)
def_op('DELETE_DEREF', 139)
hasfree.append(139)
jrel_op('JUMP_BACKWARD', 140) # Number of words to skip (backwards)
-
+name_op('LOAD_SUPER_ATTR', 141)
def_op('CALL_FUNCTION_EX', 142) # Flags
def_op('EXTENDED_ARG', 144)
@@ -264,6 +264,9 @@ pseudo_op('JUMP', 260, ['JUMP_FORWARD', 'JUMP_BACKWARD'])
pseudo_op('JUMP_NO_INTERRUPT', 261, ['JUMP_FORWARD', 'JUMP_BACKWARD_NO_INTERRUPT'])
pseudo_op('LOAD_METHOD', 262, ['LOAD_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/shadowed_super.py b/Lib/test/shadowed_super.py
new file mode 100644
index 0000000000..2a62f667e9
--- /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_gdb.py b/Lib/test/test_gdb.py
index 0f39b8f457..311a864a52 100644
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -962,7 +962,7 @@ id(42)
cmd = textwrap.dedent('''
class MyList(list):
def __init__(self):
- super().__init__() # wrapper_call()
+ super(*[]).__init__() # wrapper_call()
id("first break point")
l = MyList()
diff --git a/Lib/test/test_super.py b/Lib/test/test_super.py
index a68b38cf79..ed773a3cff 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 @@ class TestSuper(unittest.TestCase):
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,78 @@ class TestSuper(unittest.TestCase):
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_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):
+ return super().msg
+
+ 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()
+
+ 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/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 0000000000..e875b2ae7a
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2023-04-12-20-22-03.gh-issue-87729.99A7UO.rst
@@ -0,0 +1 @@
+Add :opcode:`LOAD_SUPER_ATTR` to speed up ``super().meth()`` and ``super().attr`` calls.
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index d2b77a0aec..e1497d6913 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -9346,26 +9346,20 @@ 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 *
-super_getattro(PyObject *self, PyObject *name)
+do_super_lookup(superobject *su, PyTypeObject *su_type, PyObject *su_obj,
+ PyTypeObject *su_obj_type, PyObject *name, int *method)
{
- superobject *su = (superobject *)self;
- PyTypeObject *starttype;
- PyObject *mro;
+ PyObject *mro, *res;
Py_ssize_t i, n;
+ int temp_su = 0;
- starttype = su->obj_type;
- if (starttype == 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__)))
+ if (su_obj_type == NULL)
goto skip;
- mro = starttype->tp_mro;
+ mro = su_obj_type->tp_mro;
if (mro == NULL)
goto skip;
@@ -9374,14 +9368,14 @@ 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) */
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 {
@@ -9389,19 +9383,23 @@ 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 (method && _PyType_HasFeature(Py_TYPE(res), Py_TPFLAGS_METHOD_DESCRIPTOR)) {
+ *method = 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 *)su_obj_type) ? NULL : su_obj,
+ (PyObject *)su_obj_type);
+ Py_SETREF(res, res2);
+ }
}
Py_DECREF(mro);
@@ -9417,7 +9415,34 @@ super_getattro(PyObject *self, PyObject *name)
Py_DECREF(mro);
skip:
- return PyObject_GenericGetAttr(self, name);
+ if (su == NULL) {
+ PyObject *args[] = {(PyObject *)su_type, su_obj};
+ su = (superobject *)PyObject_Vectorcall((PyObject *)&PySuper_Type, args, 2, 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;
+
+ /* 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);
}
static PyTypeObject *
@@ -9473,6 +9498,18 @@ supercheck(PyTypeObject *type, PyObject *obj)
return NULL;
}
+PyObject *
+_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, method);
+ 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 7af96b4a5e..dc66059cc8 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"
@@ -1553,6 +1554,36 @@ dummy_func(
PREDICT(JUMP_BACKWARD);
}
+ 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 method = 0;
+ Py_DECREF(global_super);
+ 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 (method) {
+ res2 = res;
+ res = self; // transfer ownership
+ } else {
+ res2 = NULL;
+ Py_DECREF(self);
+ }
+ } else {
+ 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);
+ 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 358835024f..5d5221b2e4 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 99ef7c3a31..a0ad3687f5 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -829,6 +829,10 @@ 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;
}
@@ -1047,6 +1051,24 @@ compiler_addop_name(struct compiler_unit *u, location loc,
arg <<= 1;
arg |= 1;
}
+ if (opcode == LOAD_SUPER_ATTR) {
+ arg <<= 2;
+ arg |= 2;
+ }
+ if (opcode == LOAD_SUPER_METHOD) {
+ opcode = LOAD_SUPER_ATTR;
+ arg <<= 2;
+ arg |= 3;
+ }
+ if (opcode == LOAD_ZERO_SUPER_ATTR) {
+ opcode = LOAD_SUPER_ATTR;
+ arg <<= 2;
+ }
+ if (opcode == LOAD_ZERO_SUPER_METHOD) {
+ opcode = LOAD_SUPER_ATTR;
+ arg <<= 2;
+ arg |= 1;
+ }
return codegen_addop_i(&u->u_instr_sequence, opcode, arg, loc);
}
@@ -4230,6 +4252,89 @@ is_import_originated(struct compiler *c, expr_ty e)
return flags & DEF_IMPORT;
}
+static int
+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;
+ // 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;
+ }
+
+ 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) {
+ 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_super(struct compiler *c, expr_ty e) {
+ location loc = LOC(e);
+
+ // load super() global
+ 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);
+ 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
@@ -4297,11 +4402,21 @@ 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 (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;
+ 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);
+ ADDOP_NAME(c, loc, LOAD_METHOD, meth->v.Attribute.attr, names);
+ }
+
VISIT_SEQ(c, expr, e->v.Call.args);
if (kwdsl) {
@@ -5309,6 +5424,13 @@ 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)) {
+ 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);
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 0928f8200a..0b5a91f7a1 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;
@@ -723,7 +723,7 @@
TARGET(LIST_APPEND) {
PyObject *v = stack_pointer[-1];
PyObject *list = stack_pointer[-(2 + (oparg-1))];
- #line 514 "Python/bytecodes.c"
+ #line 515 "Python/bytecodes.c"
if (_PyList_AppendTakeRef((PyListObject *)list, v) < 0) goto pop_1_error;
#line 729 "Python/generated_cases.c.h"
STACK_SHRINK(1);
@@ -734,11 +734,11 @@
TARGET(SET_ADD) {
PyObject *v = stack_pointer[-1];
PyObject *set = stack_pointer[-(2 + (oparg-1))];
- #line 519 "Python/bytecodes.c"
+ #line 520 "Python/bytecodes.c"
int err = PySet_Add(set, v);
#line 740 "Python/generated_cases.c.h"
Py_DECREF(v);
- #line 521 "Python/bytecodes.c"
+ #line 522 "Python/bytecodes.c"
if (err) goto pop_1_error;
#line 744 "Python/generated_cases.c.h"
STACK_SHRINK(1);
@@ -753,7 +753,7 @@
PyObject *container = stack_pointer[-2];
PyObject *v = stack_pointer[-3];
uint16_t counter = read_u16(&next_instr[0].cache);
- #line 532 "Python/bytecodes.c"
+ #line 533 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
next_instr--;
@@ -772,7 +772,7 @@
Py_DECREF(v);
Py_DECREF(container);
Py_DECREF(sub);
- #line 547 "Python/bytecodes.c"
+ #line 548 "Python/bytecodes.c"
if (err) goto pop_3_error;
#line 778 "Python/generated_cases.c.h"
STACK_SHRINK(3);
@@ -784,7 +784,7 @@
PyObject *sub = stack_pointer[-1];
PyObject *list = stack_pointer[-2];
PyObject *value = stack_pointer[-3];
- #line 551 "Python/bytecodes.c"
+ #line 552 "Python/bytecodes.c"
DEOPT_IF(!PyLong_CheckExact(sub), STORE_SUBSCR);
DEOPT_IF(!PyList_CheckExact(list), STORE_SUBSCR);
@@ -811,7 +811,7 @@
PyObject *sub = stack_pointer[-1];
PyObject *dict = stack_pointer[-2];
PyObject *value = stack_pointer[-3];
- #line 570 "Python/bytecodes.c"
+ #line 571 "Python/bytecodes.c"
DEOPT_IF(!PyDict_CheckExact(dict), STORE_SUBSCR);
STAT_INC(STORE_SUBSCR, hit);
int err = _PyDict_SetItem_Take2((PyDictObject *)dict, sub, value);
@@ -826,13 +826,13 @@
TARGET(DELETE_SUBSCR) {
PyObject *sub = stack_pointer[-1];
PyObject *container = stack_pointer[-2];
- #line 578 "Python/bytecodes.c"
+ #line 579 "Python/bytecodes.c"
/* del container[sub] */
int err = PyObject_DelItem(container, sub);
#line 833 "Python/generated_cases.c.h"
Py_DECREF(container);
Py_DECREF(sub);
- #line 581 "Python/bytecodes.c"
+ #line 582 "Python/bytecodes.c"
if (err) goto pop_2_error;
#line 838 "Python/generated_cases.c.h"
STACK_SHRINK(2);
@@ -842,12 +842,12 @@
TARGET(CALL_INTRINSIC_1) {
PyObject *value = stack_pointer[-1];
PyObject *res;
- #line 585 "Python/bytecodes.c"
+ #line 586 "Python/bytecodes.c"
assert(oparg <= MAX_INTRINSIC_1);
res = _PyIntrinsics_UnaryFunctions[oparg](tstate, value);
#line 849 "Python/generated_cases.c.h"
Py_DECREF(value);
- #line 588 "Python/bytecodes.c"
+ #line 589 "Python/bytecodes.c"
if (res == NULL) goto pop_1_error;
#line 853 "Python/generated_cases.c.h"
stack_pointer[-1] = res;
@@ -858,13 +858,13 @@
PyObject *value1 = stack_pointer[-1];
PyObject *value2 = stack_pointer[-2];
PyObject *res;
- #line 592 "Python/bytecodes.c"
+ #line 593 "Python/bytecodes.c"
assert(oparg <= MAX_INTRINSIC_2);
res = _PyIntrinsics_BinaryFunctions[oparg](tstate, value2, value1);
#line 865 "Python/generated_cases.c.h"
Py_DECREF(value2);
Py_DECREF(value1);
- #line 595 "Python/bytecodes.c"
+ #line 596 "Python/bytecodes.c"
if (res == NULL) goto pop_2_error;
#line 870 "Python/generated_cases.c.h"
STACK_SHRINK(1);
@@ -874,7 +874,7 @@
TARGET(RAISE_VARARGS) {
PyObject **args = (stack_pointer - oparg);
- #line 599 "Python/bytecodes.c"
+ #line 600 "Python/bytecodes.c"
PyObject *cause = NULL, *exc = NULL;
switch (oparg) {
case 2:
@@ -897,7 +897,7 @@
TARGET(INTERPRETER_EXIT) {
PyObject *retval = stack_pointer[-1];
- #line 619 "Python/bytecodes.c"
+ #line 620 "Python/bytecodes.c"
assert(frame == &entry_frame);
assert(_PyFrame_IsIncomplete(frame));
STACK_SHRINK(1); // Since we're not going to DISPATCH()
@@ -913,7 +913,7 @@
TARGET(RETURN_VALUE) {
PyObject *retval = stack_pointer[-1];
- #line 632 "Python/bytecodes.c"
+ #line 633 "Python/bytecodes.c"
STACK_SHRINK(1);
assert(EMPTY());
_PyFrame_SetStackPointer(frame, stack_pointer);
@@ -931,7 +931,7 @@
TARGET(INSTRUMENTED_RETURN_VALUE) {
PyObject *retval = stack_pointer[-1];
- #line 647 "Python/bytecodes.c"
+ #line 648 "Python/bytecodes.c"
int err = _Py_call_instrumentation_arg(
tstate, PY_MONITORING_EVENT_PY_RETURN,
frame, next_instr-1, retval);
@@ -952,7 +952,7 @@
}
TARGET(RETURN_CONST) {
- #line 666 "Python/bytecodes.c"
+ #line 667 "Python/bytecodes.c"
PyObject *retval = GETITEM(frame->f_code->co_consts, oparg);
Py_INCREF(retval);
assert(EMPTY());
@@ -970,7 +970,7 @@
}
TARGET(INSTRUMENTED_RETURN_CONST) {
- #line 682 "Python/bytecodes.c"
+ #line 683 "Python/bytecodes.c"
PyObject *retval = GETITEM(frame->f_code->co_consts, oparg);
int err = _Py_call_instrumentation_arg(
tstate, PY_MONITORING_EVENT_PY_RETURN,
@@ -994,7 +994,7 @@
TARGET(GET_AITER) {
PyObject *obj = stack_pointer[-1];
PyObject *iter;
- #line 702 "Python/bytecodes.c"
+ #line 703 "Python/bytecodes.c"
unaryfunc getter = NULL;
PyTypeObject *type = Py_TYPE(obj);
@@ -1009,14 +1009,14 @@
type->tp_name);
#line 1011 "Python/generated_cases.c.h"
Py_DECREF(obj);
- #line 715 "Python/bytecodes.c"
+ #line 716 "Python/bytecodes.c"
if (true) goto pop_1_error;
}
iter = (*getter)(obj);
#line 1018 "Python/generated_cases.c.h"
Py_DECREF(obj);
- #line 720 "Python/bytecodes.c"
+ #line 721 "Python/bytecodes.c"
if (iter == NULL) goto pop_1_error;
if (Py_TYPE(iter)->tp_as_async == NULL ||
@@ -1037,7 +1037,7 @@
TARGET(GET_ANEXT) {
PyObject *aiter = stack_pointer[-1];
PyObject *awaitable;
- #line 735 "Python/bytecodes.c"
+ #line 736 "Python/bytecodes.c"
unaryfunc getter = NULL;
PyObject *next_iter = NULL;
PyTypeObject *type = Py_TYPE(aiter);
@@ -1092,7 +1092,7 @@
PREDICTED(GET_AWAITABLE);
PyObject *iterable = stack_pointer[-1];
PyObject *iter;
- #line 782 "Python/bytecodes.c"
+ #line 783 "Python/bytecodes.c"
iter = _PyCoro_GetAwaitableIter(iterable);
if (iter == NULL) {
@@ -1101,7 +1101,7 @@
#line 1103 "Python/generated_cases.c.h"
Py_DECREF(iterable);
- #line 789 "Python/bytecodes.c"
+ #line 790 "Python/bytecodes.c"
if (iter != NULL && PyCoro_CheckExact(iter)) {
PyObject *yf = _PyGen_yf((PyGenObject*)iter);
@@ -1130,7 +1130,7 @@
PyObject *v = stack_pointer[-1];
PyObject *receiver = stack_pointer[-2];
PyObject *retval;
- #line 815 "Python/bytecodes.c"
+ #line 816 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
_PySendCache *cache = (_PySendCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -1185,7 +1185,7 @@
TARGET(SEND_GEN) {
PyObject *v = stack_pointer[-1];
PyObject *receiver = stack_pointer[-2];
- #line 863 "Python/bytecodes.c"
+ #line 864 "Python/bytecodes.c"
PyGenObject *gen = (PyGenObject *)receiver;
DEOPT_IF(Py_TYPE(gen) != &PyGen_Type &&
Py_TYPE(gen) != &PyCoro_Type, SEND);
@@ -1205,7 +1205,7 @@
TARGET(INSTRUMENTED_YIELD_VALUE) {
PyObject *retval = stack_pointer[-1];
- #line 880 "Python/bytecodes.c"
+ #line 881 "Python/bytecodes.c"
assert(frame != &entry_frame);
PyGenObject *gen = _PyFrame_GetGenerator(frame);
gen->gi_frame_state = FRAME_SUSPENDED;
@@ -1227,7 +1227,7 @@
TARGET(YIELD_VALUE) {
PyObject *retval = stack_pointer[-1];
- #line 899 "Python/bytecodes.c"
+ #line 900 "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.
@@ -1248,7 +1248,7 @@
TARGET(POP_EXCEPT) {
PyObject *exc_value = stack_pointer[-1];
- #line 917 "Python/bytecodes.c"
+ #line 918 "Python/bytecodes.c"
_PyErr_StackItem *exc_info = tstate->exc_info;
Py_XSETREF(exc_info->exc_value, exc_value);
#line 1255 "Python/generated_cases.c.h"
@@ -1259,7 +1259,7 @@
TARGET(RERAISE) {
PyObject *exc = stack_pointer[-1];
PyObject **values = (stack_pointer - (1 + oparg));
- #line 922 "Python/bytecodes.c"
+ #line 923 "Python/bytecodes.c"
assert(oparg >= 0 && oparg <= 2);
if (oparg) {
PyObject *lasti = values[0];
@@ -1283,13 +1283,13 @@
TARGET(END_ASYNC_FOR) {
PyObject *exc = stack_pointer[-1];
PyObject *awaitable = stack_pointer[-2];
- #line 942 "Python/bytecodes.c"
+ #line 943 "Python/bytecodes.c"
assert(exc && PyExceptionInstance_Check(exc));
if (PyErr_GivenExceptionMatches(exc, PyExc_StopAsyncIteration)) {
#line 1290 "Python/generated_cases.c.h"
Py_DECREF(awaitable);
Py_DECREF(exc);
- #line 945 "Python/bytecodes.c"
+ #line 946 "Python/bytecodes.c"
}
else {
Py_INCREF(exc);
@@ -1307,7 +1307,7 @@
PyObject *sub_iter = stack_pointer[-3];
PyObject *none;
PyObject *value;
- #line 954 "Python/bytecodes.c"
+ #line 955 "Python/bytecodes.c"
assert(throwflag);
assert(exc_value && PyExceptionInstance_Check(exc_value));
if (PyErr_GivenExceptionMatches(exc_value, PyExc_StopIteration)) {
@@ -1316,7 +1316,7 @@
Py_DECREF(sub_iter);
Py_DECREF(last_sent_val);
Py_DECREF(exc_value);
- #line 959 "Python/bytecodes.c"
+ #line 960 "Python/bytecodes.c"
none = Py_NewRef(Py_None);
}
else {
@@ -1332,7 +1332,7 @@
TARGET(LOAD_ASSERTION_ERROR) {
PyObject *value;
- #line 968 "Python/bytecodes.c"
+ #line 969 "Python/bytecodes.c"
value = Py_NewRef(PyExc_AssertionError);
#line 1338 "Python/generated_cases.c.h"
STACK_GROW(1);
@@ -1342,7 +1342,7 @@
TARGET(LOAD_BUILD_CLASS) {
PyObject *bc;
- #line 972 "Python/bytecodes.c"
+ #line 973 "Python/bytecodes.c"
if (PyDict_CheckExact(BUILTINS())) {
bc = _PyDict_GetItemWithError(BUILTINS(),
&_Py_ID(__build_class__));
@@ -1372,7 +1372,7 @@
TARGET(STORE_NAME) {
PyObject *v = stack_pointer[-1];
- #line 996 "Python/bytecodes.c"
+ #line 997 "Python/bytecodes.c"
PyObject *name = GETITEM(frame->f_code->co_names, oparg);
PyObject *ns = LOCALS();
int err;
@@ -1381,7 +1381,7 @@
"no locals found when storing %R", name);
#line 1383 "Python/generated_cases.c.h"
Py_DECREF(v);
- #line 1003 "Python/bytecodes.c"
+ #line 1004 "Python/bytecodes.c"
if (true) goto pop_1_error;
}
if (PyDict_CheckExact(ns))
@@ -1390,7 +1390,7 @@
err = PyObject_SetItem(ns, name, v);
#line 1392 "Python/generated_cases.c.h"
Py_DECREF(v);
- #line 1010 "Python/bytecodes.c"
+ #line 1011 "Python/bytecodes.c"
if (err) goto pop_1_error;
#line 1396 "Python/generated_cases.c.h"
STACK_SHRINK(1);
@@ -1398,7 +1398,7 @@
}
TARGET(DELETE_NAME) {
- #line 1014 "Python/bytecodes.c"
+ #line 1015 "Python/bytecodes.c"
PyObject *name = GETITEM(frame->f_code->co_names, oparg);
PyObject *ns = LOCALS();
int err;
@@ -1423,7 +1423,7 @@
PREDICTED(UNPACK_SEQUENCE);
static_assert(INLINE_CACHE_ENTRIES_UNPACK_SEQUENCE == 1, "incorrect cache size");
PyObject *seq = stack_pointer[-1];
- #line 1040 "Python/bytecodes.c"
+ #line 1041 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
_PyUnpackSequenceCache *cache = (_PyUnpackSequenceCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -1438,7 +1438,7 @@
int res = unpack_iterable(tstate, seq, oparg, -1, top);
#line 1440 "Python/generated_cases.c.h"
Py_DECREF(seq);
- #line 1053 "Python/bytecodes.c"
+ #line 1054 "Python/bytecodes.c"
if (res == 0) goto pop_1_error;
#line 1444 "Python/generated_cases.c.h"
STACK_SHRINK(1);
@@ -1450,7 +1450,7 @@
TARGET(UNPACK_SEQUENCE_TWO_TUPLE) {
PyObject *seq = stack_pointer[-1];
PyObject **values = stack_pointer - (1);
- #line 1057 "Python/bytecodes.c"
+ #line 1058 "Python/bytecodes.c"
DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE);
DEOPT_IF(PyTuple_GET_SIZE(seq) != 2, UNPACK_SEQUENCE);
assert(oparg == 2);
@@ -1468,7 +1468,7 @@
TARGET(UNPACK_SEQUENCE_TUPLE) {
PyObject *seq = stack_pointer[-1];
PyObject **values = stack_pointer - (1);
- #line 1067 "Python/bytecodes.c"
+ #line 1068 "Python/bytecodes.c"
DEOPT_IF(!PyTuple_CheckExact(seq), UNPACK_SEQUENCE);
DEOPT_IF(PyTuple_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE);
STAT_INC(UNPACK_SEQUENCE, hit);
@@ -1487,7 +1487,7 @@
TARGET(UNPACK_SEQUENCE_LIST) {
PyObject *seq = stack_pointer[-1];
PyObject **values = stack_pointer - (1);
- #line 1078 "Python/bytecodes.c"
+ #line 1079 "Python/bytecodes.c"
DEOPT_IF(!PyList_CheckExact(seq), UNPACK_SEQUENCE);
DEOPT_IF(PyList_GET_SIZE(seq) != oparg, UNPACK_SEQUENCE);
STAT_INC(UNPACK_SEQUENCE, hit);
@@ -1505,13 +1505,13 @@
TARGET(UNPACK_EX) {
PyObject *seq = stack_pointer[-1];
- #line 1089 "Python/bytecodes.c"
+ #line 1090 "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 1513 "Python/generated_cases.c.h"
Py_DECREF(seq);
- #line 1093 "Python/bytecodes.c"
+ #line 1094 "Python/bytecodes.c"
if (res == 0) goto pop_1_error;
#line 1517 "Python/generated_cases.c.h"
STACK_GROW((oparg & 0xFF) + (oparg >> 8));
@@ -1524,7 +1524,7 @@
PyObject *owner = stack_pointer[-1];
PyObject *v = stack_pointer[-2];
uint16_t counter = read_u16(&next_instr[0].cache);
- #line 1104 "Python/bytecodes.c"
+ #line 1105 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
if (ADAPTIVE_COUNTER_IS_ZERO(counter)) {
PyObject *name = GETITEM(frame->f_code->co_names, oparg);
@@ -1543,7 +1543,7 @@
#line 1544 "Python/generated_cases.c.h"
Py_DECREF(v);
Py_DECREF(owner);
- #line 1120 "Python/bytecodes.c"
+ #line 1121 "Python/bytecodes.c"
if (err) goto pop_2_error;
#line 1549 "Python/generated_cases.c.h"
STACK_SHRINK(2);
@@ -1553,12 +1553,12 @@
TARGET(DELETE_ATTR) {
PyObject *owner = stack_pointer[-1];
- #line 1124 "Python/bytecodes.c"
+ #line 1125 "Python/bytecodes.c"
PyObject *name = GETITEM(frame->f_code->co_names, oparg);
int err = PyObject_SetAttr(owner, name, (PyObject *)NULL);
#line 1560 "Python/generated_cases.c.h"
Py_DECREF(owner);
- #line 1127 "Python/bytecodes.c"
+ #line 1128 "Python/bytecodes.c"
if (err) goto pop_1_error;
#line 1564 "Python/generated_cases.c.h"
STACK_SHRINK(1);
@@ -1567,12 +1567,12 @@
TARGET(STORE_GLOBAL) {
PyObject *v = stack_pointer[-1];
- #line 1131 "Python/bytecodes.c"
+ #line 1132 "Python/bytecodes.c"
PyObject *name = GETITEM(frame->f_code->co_names, oparg);
int err = PyDict_SetItem(GLOBALS(), name, v);
#line 1574 "Python/generated_cases.c.h"
Py_DECREF(v);
- #line 1134 "Python/bytecodes.c"
+ #line 1135 "Python/bytecodes.c"
if (err) goto pop_1_error;
#line 1578 "Python/generated_cases.c.h"
STACK_SHRINK(1);
@@ -1580,7 +1580,7 @@
}
TARGET(DELETE_GLOBAL) {
- #line 1138 "Python/bytecodes.c"
+ #line 1139 "Python/bytecodes.c"
PyObject *name = GETITEM(frame->f_code->co_names, oparg);
int err;
err = PyDict_DelItem(GLOBALS(), name);
@@ -1598,7 +1598,7 @@
TARGET(LOAD_NAME) {
PyObject *v;
- #line 1152 "Python/bytecodes.c"
+ #line 1153 "Python/bytecodes.c"
PyObject *name = GETITEM(frame->f_code->co_names, oparg);
PyObject *locals = LOCALS();
if (locals == NULL) {
@@ -1668,7 +1668,7 @@
static_assert(INLINE_CACHE_ENTRIES_LOAD_GLOBAL == 4, "incorrect cache size");
PyObject *null = NULL;
PyObject *v;
- #line 1219 "Python/bytecodes.c"
+ #line 1220 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
_PyLoadGlobalCache *cache = (_PyLoadGlobalCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -1734,7 +1734,7 @@
PyObject *res;
uint16_t index = read_u16(&next_instr[1].cache);
uint16_t version = read_u16(&next_instr[2].cache);
- #line 1273 "Python/bytecodes.c"
+ #line 1274 "Python/bytecodes.c"
DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL);
PyDictObject *dict = (PyDictObject *)GLOBALS();
DEOPT_IF(dict->ma_keys->dk_version != version, LOAD_GLOBAL);
@@ -1760,7 +1760,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 1286 "Python/bytecodes.c"
+ #line 1287 "Python/bytecodes.c"
DEOPT_IF(!PyDict_CheckExact(GLOBALS()), LOAD_GLOBAL);
DEOPT_IF(!PyDict_CheckExact(BUILTINS()), LOAD_GLOBAL);
PyDictObject *mdict = (PyDictObject *)GLOBALS();
@@ -1785,7 +1785,7 @@
}
TARGET(DELETE_FAST) {
- #line 1303 "Python/bytecodes.c"
+ #line 1304 "Python/bytecodes.c"
PyObject *v = GETLOCAL(oparg);
if (v == NULL) goto unbound_local_error;
SETLOCAL(oparg, NULL);
@@ -1794,7 +1794,7 @@
}
TARGET(MAKE_CELL) {
- #line 1309 "Python/bytecodes.c"
+ #line 1310 "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);
@@ -1808,7 +1808,7 @@
}
TARGET(DELETE_DEREF) {
- #line 1320 "Python/bytecodes.c"
+ #line 1321 "Python/bytecodes.c"
PyObject *cell = GETLOCAL(oparg);
PyObject *oldobj = PyCell_GET(cell);
// Can't use ERROR_IF here.
@@ -1825,7 +1825,7 @@
TARGET(LOAD_CLASSDEREF) {
PyObject *value;
- #line 1333 "Python/bytecodes.c"
+ #line 1334 "Python/bytecodes.c"
PyObject *name, *locals = LOCALS();
assert(locals);
assert(oparg >= 0 && oparg < frame->f_code->co_nlocalsplus);
@@ -1865,7 +1865,7 @@
TARGET(LOAD_DEREF) {
PyObject *value;
- #line 1367 "Python/bytecodes.c"
+ #line 1368 "Python/bytecodes.c"
PyObject *cell = GETLOCAL(oparg);
value = PyCell_GET(cell);
if (value == NULL) {
@@ -1881,7 +1881,7 @@
TARGET(STORE_DEREF) {
PyObject *v = stack_pointer[-1];
- #line 1377 "Python/bytecodes.c"
+ #line 1378 "Python/bytecodes.c"
PyObject *cell = GETLOCAL(oparg);
PyObject *oldobj = PyCell_GET(cell);
PyCell_SET(cell, v);
@@ -1892,7 +1892,7 @@
}
TARGET(COPY_FREE_VARS) {
- #line 1384 "Python/bytecodes.c"
+ #line 1385 "Python/bytecodes.c"
/* Copy closure variables to free variables */
PyCodeObject *co = frame->f_code;
assert(PyFunction_Check(frame->f_funcobj));
@@ -1910,13 +1910,13 @@
TARGET(BUILD_STRING) {
PyObject **pieces = (stack_pointer - oparg);
PyObject *str;
- #line 1397 "Python/bytecodes.c"
+ #line 1398 "Python/bytecodes.c"
str = _PyUnicode_JoinArray(&_Py_STR(empty), pieces, oparg);
#line 1916 "Python/generated_cases.c.h"
for (int _i = oparg; --_i >= 0;) {
Py_DECREF(pieces[_i]);
}
- #line 1399 "Python/bytecodes.c"
+ #line 1400 "Python/bytecodes.c"
if (str == NULL) { STACK_SHRINK(oparg); goto error; }
#line 1922 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
@@ -1928,7 +1928,7 @@
TARGET(BUILD_TUPLE) {
PyObject **values = (stack_pointer - oparg);
PyObject *tup;
- #line 1403 "Python/bytecodes.c"
+ #line 1404 "Python/bytecodes.c"
tup = _PyTuple_FromArraySteal(values, oparg);
if (tup == NULL) { STACK_SHRINK(oparg); goto error; }
#line 1935 "Python/generated_cases.c.h"
@@ -1941,7 +1941,7 @@
TARGET(BUILD_LIST) {
PyObject **values = (stack_pointer - oparg);
PyObject *list;
- #line 1408 "Python/bytecodes.c"
+ #line 1409 "Python/bytecodes.c"
list = _PyList_FromArraySteal(values, oparg);
if (list == NULL) { STACK_SHRINK(oparg); goto error; }
#line 1948 "Python/generated_cases.c.h"
@@ -1954,7 +1954,7 @@
TARGET(LIST_EXTEND) {
PyObject *iterable = stack_pointer[-1];
PyObject *list = stack_pointer[-(2 + (oparg-1))];
- #line 1413 "Python/bytecodes.c"
+ #line 1414 "Python/bytecodes.c"
PyObject *none_val = _PyList_Extend((PyListObject *)list, iterable);
if (none_val == NULL) {
if (_PyErr_ExceptionMatches(tstate, PyExc_TypeError) &&
@@ -1967,7 +1967,7 @@
}
#line 1969 "Python/generated_cases.c.h"
Py_DECREF(iterable);
- #line 1424 "Python/bytecodes.c"
+ #line 1425 "Python/bytecodes.c"
if (true) goto pop_1_error;
}
Py_DECREF(none_val);
@@ -1980,11 +1980,11 @@
TARGET(SET_UPDATE) {
PyObject *iterable = stack_pointer[-1];
PyObject *set = stack_pointer[-(2 + (oparg-1))];
- #line 1431 "Python/bytecodes.c"
+ #line 1432 "Python/bytecodes.c"
int err = _PySet_Update(set, iterable);
#line 1986 "Python/generated_cases.c.h"
Py_DECREF(iterable);
- #line 1433 "Python/bytecodes.c"
+ #line 1434 "Python/bytecodes.c"
if (err < 0) goto pop_1_error;
#line 1990 "Python/generated_cases.c.h"
STACK_SHRINK(1);
@@ -1994,7 +1994,7 @@
TARGET(BUILD_SET) {
PyObject **values = (stack_pointer - oparg);
PyObject *set;
- #line 1437 "Python/bytecodes.c"
+ #line 1438 "Python/bytecodes.c"
set = PySet_New(NULL);
if (set == NULL)
goto error;
@@ -2019,7 +2019,7 @@
TARGET(BUILD_MAP) {
PyObject **values = (stack_pointer - oparg*2);
PyObject *map;
- #line 1454 "Python/bytecodes.c"
+ #line 1455 "Python/bytecodes.c"
map = _PyDict_FromItems(
values, 2,
values+1, 2,
@@ -2031,7 +2031,7 @@
for (int _i = oparg*2; --_i >= 0;) {
Py_DECREF(values[_i]);
}
- #line 1462 "Python/bytecodes.c"
+ #line 1463 "Python/bytecodes.c"
if (map == NULL) { STACK_SHRINK(oparg*2); goto error; }
#line 2037 "Python/generated_cases.c.h"
STACK_SHRINK(oparg*2);
@@ -2041,7 +2041,7 @@
}
TARGET(SETUP_ANNOTATIONS) {
- #line 1466 "Python/bytecodes.c"
+ #line 1467 "Python/bytecodes.c"
int err;
PyObject *ann_dict;
if (LOCALS() == NULL) {
@@ -2089,7 +2089,7 @@
PyObject *keys = stack_pointer[-1];
PyObject **values = (stack_pointer - (1 + oparg));
PyObject *map;
- #line 1508 "Python/bytecodes.c"
+ #line 1509 "Python/bytecodes.c"
if (!PyTuple_CheckExact(keys) ||
PyTuple_GET_SIZE(keys) != (Py_ssize_t)oparg) {
_PyErr_SetString(tstate, PyExc_SystemError,
@@ -2104,7 +2104,7 @@
Py_DECREF(values[_i]);
}
Py_DECREF(keys);
- #line 1518 "Python/bytecodes.c"
+ #line 1519 "Python/bytecodes.c"
if (map == NULL) { STACK_SHRINK(oparg); goto pop_1_error; }
#line 2110 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
@@ -2114,7 +2114,7 @@
TARGET(DICT_UPDATE) {
PyObject *update = stack_pointer[-1];
- #line 1522 "Python/bytecodes.c"
+ #line 1523 "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)) {
@@ -2124,7 +2124,7 @@
}
#line 2126 "Python/generated_cases.c.h"
Py_DECREF(update);
- #line 1530 "Python/bytecodes.c"
+ #line 1531 "Python/bytecodes.c"
if (true) goto pop_1_error;
}
#line 2131 "Python/generated_cases.c.h"
@@ -2135,14 +2135,14 @@
TARGET(DICT_MERGE) {
PyObject *update = stack_pointer[-1];
- #line 1536 "Python/bytecodes.c"
+ #line 1537 "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 2144 "Python/generated_cases.c.h"
Py_DECREF(update);
- #line 1541 "Python/bytecodes.c"
+ #line 1542 "Python/bytecodes.c"
if (true) goto pop_1_error;
}
#line 2149 "Python/generated_cases.c.h"
@@ -2155,7 +2155,7 @@
TARGET(MAP_ADD) {
PyObject *value = stack_pointer[-1];
PyObject *key = stack_pointer[-2];
- #line 1548 "Python/bytecodes.c"
+ #line 1549 "Python/bytecodes.c"
PyObject *dict = PEEK(oparg + 2); // key, value are still on the stack
assert(PyDict_CheckExact(dict));
/* dict[key] = value */
@@ -2167,13 +2167,59 @@
DISPATCH();
}
+ 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 1558 "Python/bytecodes.c"
+ PyObject *name = GETITEM(frame->f_code->co_names, oparg >> 2);
+ if (global_super == (PyObject *)&PySuper_Type && PyType_Check(class)) {
+ int method = 0;
+ Py_DECREF(global_super);
+ 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 (method) {
+ res2 = res;
+ res = self; // transfer ownership
+ } else {
+ res2 = NULL;
+ Py_DECREF(self);
+ }
+ } else {
+ PyObject *stack[] = {class, self};
+ 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 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 2209 "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 1571 "Python/bytecodes.c"
+ #line 1602 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
_PyAttrCache *cache = (_PyAttrCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -2207,9 +2253,9 @@
NULL | meth | arg1 | ... | argN
*/
- #line 2211 "Python/generated_cases.c.h"
+ #line 2257 "Python/generated_cases.c.h"
Py_DECREF(owner);
- #line 1605 "Python/bytecodes.c"
+ #line 1636 "Python/bytecodes.c"
if (meth == NULL) goto pop_1_error;
res2 = NULL;
res = meth;
@@ -2218,12 +2264,12 @@
else {
/* Classic, pushes one value. */
res = PyObject_GetAttr(owner, name);
- #line 2222 "Python/generated_cases.c.h"
+ #line 2268 "Python/generated_cases.c.h"
Py_DECREF(owner);
- #line 1614 "Python/bytecodes.c"
+ #line 1645 "Python/bytecodes.c"
if (res == NULL) goto pop_1_error;
}
- #line 2227 "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; }
@@ -2237,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 1619 "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);
@@ -2250,7 +2296,7 @@
STAT_INC(LOAD_ATTR, hit);
Py_INCREF(res);
res2 = NULL;
- #line 2254 "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;
@@ -2265,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 1635 "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);
@@ -2278,7 +2324,7 @@
STAT_INC(LOAD_ATTR, hit);
Py_INCREF(res);
res2 = NULL;
- #line 2282 "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;
@@ -2293,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 1651 "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);
@@ -2320,7 +2366,7 @@
STAT_INC(LOAD_ATTR, hit);
Py_INCREF(res);
res2 = NULL;
- #line 2324 "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;
@@ -2335,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 1681 "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);
@@ -2345,7 +2391,7 @@
STAT_INC(LOAD_ATTR, hit);
Py_INCREF(res);
res2 = NULL;
- #line 2349 "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;
@@ -2360,7 +2406,7 @@
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
PyObject *descr = read_obj(&next_instr[5].cache);
- #line 1694 "Python/bytecodes.c"
+ #line 1725 "Python/bytecodes.c"
DEOPT_IF(!PyType_Check(cls), LOAD_ATTR);
DEOPT_IF(((PyTypeObject *)cls)->tp_version_tag != type_version,
@@ -2372,7 +2418,7 @@
res = descr;
assert(res != NULL);
Py_INCREF(res);
- #line 2376 "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;
@@ -2386,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 1709 "Python/bytecodes.c"
+ #line 1740 "Python/bytecodes.c"
DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR);
PyTypeObject *cls = Py_TYPE(owner);
@@ -2410,7 +2456,7 @@
JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR);
frame->return_offset = 0;
DISPATCH_INLINED(new_frame);
- #line 2414 "Python/generated_cases.c.h"
+ #line 2460 "Python/generated_cases.c.h"
}
TARGET(LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN) {
@@ -2418,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 1735 "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);
@@ -2444,7 +2490,7 @@
JUMPBY(INLINE_CACHE_ENTRIES_LOAD_ATTR);
frame->return_offset = 0;
DISPATCH_INLINED(new_frame);
- #line 2448 "Python/generated_cases.c.h"
+ #line 2494 "Python/generated_cases.c.h"
}
TARGET(STORE_ATTR_INSTANCE_VALUE) {
@@ -2452,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 1763 "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);
@@ -2470,7 +2516,7 @@
Py_DECREF(old_value);
}
Py_DECREF(owner);
- #line 2474 "Python/generated_cases.c.h"
+ #line 2520 "Python/generated_cases.c.h"
STACK_SHRINK(2);
next_instr += 4;
DISPATCH();
@@ -2481,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 1783 "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);
@@ -2520,7 +2566,7 @@
/* PEP 509 */
dict->ma_version_tag = new_version;
Py_DECREF(owner);
- #line 2524 "Python/generated_cases.c.h"
+ #line 2570 "Python/generated_cases.c.h"
STACK_SHRINK(2);
next_instr += 4;
DISPATCH();
@@ -2531,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 1824 "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);
@@ -2541,7 +2587,7 @@
*(PyObject **)addr = value;
Py_XDECREF(old_value);
Py_DECREF(owner);
- #line 2545 "Python/generated_cases.c.h"
+ #line 2591 "Python/generated_cases.c.h"
STACK_SHRINK(2);
next_instr += 4;
DISPATCH();
@@ -2553,7 +2599,7 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *res;
- #line 1843 "Python/bytecodes.c"
+ #line 1874 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
_PyCompareOpCache *cache = (_PyCompareOpCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -2566,12 +2612,12 @@
#endif /* ENABLE_SPECIALIZATION */
assert((oparg >> 4) <= Py_GE);
res = PyObject_RichCompare(left, right, oparg>>4);
- #line 2570 "Python/generated_cases.c.h"
+ #line 2616 "Python/generated_cases.c.h"
Py_DECREF(left);
Py_DECREF(right);
- #line 1856 "Python/bytecodes.c"
+ #line 1887 "Python/bytecodes.c"
if (res == NULL) goto pop_2_error;
- #line 2575 "Python/generated_cases.c.h"
+ #line 2621 "Python/generated_cases.c.h"
STACK_SHRINK(1);
stack_pointer[-1] = res;
next_instr += 1;
@@ -2582,7 +2628,7 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *res;
- #line 1860 "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);
@@ -2594,7 +2640,7 @@
_Py_DECREF_SPECIALIZED(right, _PyFloat_ExactDealloc);
res = (sign_ish & oparg) ? Py_True : Py_False;
Py_INCREF(res);
- #line 2598 "Python/generated_cases.c.h"
+ #line 2644 "Python/generated_cases.c.h"
STACK_SHRINK(1);
stack_pointer[-1] = res;
next_instr += 1;
@@ -2605,7 +2651,7 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *res;
- #line 1875 "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);
@@ -2621,7 +2667,7 @@
_Py_DECREF_SPECIALIZED(right, (destructor)PyObject_Free);
res = (sign_ish & oparg) ? Py_True : Py_False;
Py_INCREF(res);
- #line 2625 "Python/generated_cases.c.h"
+ #line 2671 "Python/generated_cases.c.h"
STACK_SHRINK(1);
stack_pointer[-1] = res;
next_instr += 1;
@@ -2632,7 +2678,7 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *res;
- #line 1894 "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);
@@ -2645,7 +2691,7 @@
assert(COMPARISON_NOT_EQUALS + 1 == COMPARISON_EQUALS);
res = ((COMPARISON_NOT_EQUALS + eq) & oparg) ? Py_True : Py_False;
Py_INCREF(res);
- #line 2649 "Python/generated_cases.c.h"
+ #line 2695 "Python/generated_cases.c.h"
STACK_SHRINK(1);
stack_pointer[-1] = res;
next_instr += 1;
@@ -2656,14 +2702,14 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *b;
- #line 1909 "Python/bytecodes.c"
+ #line 1940 "Python/bytecodes.c"
int res = Py_Is(left, right) ^ oparg;
- #line 2662 "Python/generated_cases.c.h"
+ #line 2708 "Python/generated_cases.c.h"
Py_DECREF(left);
Py_DECREF(right);
- #line 1911 "Python/bytecodes.c"
+ #line 1942 "Python/bytecodes.c"
b = Py_NewRef(res ? Py_True : Py_False);
- #line 2667 "Python/generated_cases.c.h"
+ #line 2713 "Python/generated_cases.c.h"
STACK_SHRINK(1);
stack_pointer[-1] = b;
DISPATCH();
@@ -2673,15 +2719,15 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *b;
- #line 1915 "Python/bytecodes.c"
+ #line 1946 "Python/bytecodes.c"
int res = PySequence_Contains(right, left);
- #line 2679 "Python/generated_cases.c.h"
+ #line 2725 "Python/generated_cases.c.h"
Py_DECREF(left);
Py_DECREF(right);
- #line 1917 "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 2685 "Python/generated_cases.c.h"
+ #line 2731 "Python/generated_cases.c.h"
STACK_SHRINK(1);
stack_pointer[-1] = b;
DISPATCH();
@@ -2692,12 +2738,12 @@
PyObject *exc_value = stack_pointer[-2];
PyObject *rest;
PyObject *match;
- #line 1922 "Python/bytecodes.c"
+ #line 1953 "Python/bytecodes.c"
if (check_except_star_type_valid(tstate, match_type) < 0) {
- #line 2698 "Python/generated_cases.c.h"
+ #line 2744 "Python/generated_cases.c.h"
Py_DECREF(exc_value);
Py_DECREF(match_type);
- #line 1924 "Python/bytecodes.c"
+ #line 1955 "Python/bytecodes.c"
if (true) goto pop_2_error;
}
@@ -2705,10 +2751,10 @@
rest = NULL;
int res = exception_group_match(exc_value, match_type,
&match, &rest);
- #line 2709 "Python/generated_cases.c.h"
+ #line 2755 "Python/generated_cases.c.h"
Py_DECREF(exc_value);
Py_DECREF(match_type);
- #line 1932 "Python/bytecodes.c"
+ #line 1963 "Python/bytecodes.c"
if (res < 0) goto pop_2_error;
assert((match == NULL) == (rest == NULL));
@@ -2717,7 +2763,7 @@
if (!Py_IsNone(match)) {
PyErr_SetHandledException(match);
}
- #line 2721 "Python/generated_cases.c.h"
+ #line 2767 "Python/generated_cases.c.h"
stack_pointer[-1] = match;
stack_pointer[-2] = rest;
DISPATCH();
@@ -2727,21 +2773,21 @@
PyObject *right = stack_pointer[-1];
PyObject *left = stack_pointer[-2];
PyObject *b;
- #line 1943 "Python/bytecodes.c"
+ #line 1974 "Python/bytecodes.c"
assert(PyExceptionInstance_Check(left));
if (check_except_type_valid(tstate, right) < 0) {
- #line 2734 "Python/generated_cases.c.h"
+ #line 2780 "Python/generated_cases.c.h"
Py_DECREF(right);
- #line 1946 "Python/bytecodes.c"
+ #line 1977 "Python/bytecodes.c"
if (true) goto pop_1_error;
}
int res = PyErr_GivenExceptionMatches(left, right);
- #line 2741 "Python/generated_cases.c.h"
+ #line 2787 "Python/generated_cases.c.h"
Py_DECREF(right);
- #line 1951 "Python/bytecodes.c"
+ #line 1982 "Python/bytecodes.c"
b = Py_NewRef(res ? Py_True : Py_False);
- #line 2745 "Python/generated_cases.c.h"
+ #line 2791 "Python/generated_cases.c.h"
stack_pointer[-1] = b;
DISPATCH();
}
@@ -2750,15 +2796,15 @@
PyObject *fromlist = stack_pointer[-1];
PyObject *level = stack_pointer[-2];
PyObject *res;
- #line 1955 "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 2757 "Python/generated_cases.c.h"
+ #line 2803 "Python/generated_cases.c.h"
Py_DECREF(level);
Py_DECREF(fromlist);
- #line 1958 "Python/bytecodes.c"
+ #line 1989 "Python/bytecodes.c"
if (res == NULL) goto pop_2_error;
- #line 2762 "Python/generated_cases.c.h"
+ #line 2808 "Python/generated_cases.c.h"
STACK_SHRINK(1);
stack_pointer[-1] = res;
DISPATCH();
@@ -2767,29 +2813,29 @@
TARGET(IMPORT_FROM) {
PyObject *from = stack_pointer[-1];
PyObject *res;
- #line 1962 "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 2775 "Python/generated_cases.c.h"
+ #line 2821 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = res;
DISPATCH();
}
TARGET(JUMP_FORWARD) {
- #line 1968 "Python/bytecodes.c"
+ #line 1999 "Python/bytecodes.c"
JUMPBY(oparg);
- #line 2784 "Python/generated_cases.c.h"
+ #line 2830 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(JUMP_BACKWARD) {
PREDICTED(JUMP_BACKWARD);
- #line 1972 "Python/bytecodes.c"
+ #line 2003 "Python/bytecodes.c"
assert(oparg < INSTR_OFFSET());
JUMPBY(-oparg);
- #line 2793 "Python/generated_cases.c.h"
+ #line 2839 "Python/generated_cases.c.h"
CHECK_EVAL_BREAKER();
DISPATCH();
}
@@ -2797,7 +2843,7 @@
TARGET(POP_JUMP_IF_FALSE) {
PREDICTED(POP_JUMP_IF_FALSE);
PyObject *cond = stack_pointer[-1];
- #line 1978 "Python/bytecodes.c"
+ #line 2009 "Python/bytecodes.c"
if (Py_IsTrue(cond)) {
_Py_DECREF_NO_DEALLOC(cond);
}
@@ -2807,9 +2853,9 @@
}
else {
int err = PyObject_IsTrue(cond);
- #line 2811 "Python/generated_cases.c.h"
+ #line 2857 "Python/generated_cases.c.h"
Py_DECREF(cond);
- #line 1988 "Python/bytecodes.c"
+ #line 2019 "Python/bytecodes.c"
if (err == 0) {
JUMPBY(oparg);
}
@@ -2817,14 +2863,14 @@
if (err < 0) goto pop_1_error;
}
}
- #line 2821 "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 1998 "Python/bytecodes.c"
+ #line 2029 "Python/bytecodes.c"
if (Py_IsFalse(cond)) {
_Py_DECREF_NO_DEALLOC(cond);
}
@@ -2834,9 +2880,9 @@
}
else {
int err = PyObject_IsTrue(cond);
- #line 2838 "Python/generated_cases.c.h"
+ #line 2884 "Python/generated_cases.c.h"
Py_DECREF(cond);
- #line 2008 "Python/bytecodes.c"
+ #line 2039 "Python/bytecodes.c"
if (err > 0) {
JUMPBY(oparg);
}
@@ -2844,67 +2890,67 @@
if (err < 0) goto pop_1_error;
}
}
- #line 2848 "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 2018 "Python/bytecodes.c"
+ #line 2049 "Python/bytecodes.c"
if (!Py_IsNone(value)) {
- #line 2857 "Python/generated_cases.c.h"
+ #line 2903 "Python/generated_cases.c.h"
Py_DECREF(value);
- #line 2020 "Python/bytecodes.c"
+ #line 2051 "Python/bytecodes.c"
JUMPBY(oparg);
}
else {
_Py_DECREF_NO_DEALLOC(value);
}
- #line 2865 "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 2028 "Python/bytecodes.c"
+ #line 2059 "Python/bytecodes.c"
if (Py_IsNone(value)) {
_Py_DECREF_NO_DEALLOC(value);
JUMPBY(oparg);
}
else {
- #line 2878 "Python/generated_cases.c.h"
+ #line 2924 "Python/generated_cases.c.h"
Py_DECREF(value);
- #line 2034 "Python/bytecodes.c"
+ #line 2065 "Python/bytecodes.c"
}
- #line 2882 "Python/generated_cases.c.h"
+ #line 2928 "Python/generated_cases.c.h"
STACK_SHRINK(1);
DISPATCH();
}
TARGET(JUMP_BACKWARD_NO_INTERRUPT) {
- #line 2038 "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 2895 "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 2047 "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 2908 "Python/generated_cases.c.h"
+ #line 2954 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = len_o;
DISPATCH();
@@ -2915,16 +2961,16 @@
PyObject *type = stack_pointer[-2];
PyObject *subject = stack_pointer[-3];
PyObject *attrs;
- #line 2055 "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 2924 "Python/generated_cases.c.h"
+ #line 2970 "Python/generated_cases.c.h"
Py_DECREF(subject);
Py_DECREF(type);
Py_DECREF(names);
- #line 2060 "Python/bytecodes.c"
+ #line 2091 "Python/bytecodes.c"
if (attrs) {
assert(PyTuple_CheckExact(attrs)); // Success!
}
@@ -2932,7 +2978,7 @@
if (_PyErr_Occurred(tstate)) goto pop_3_error;
attrs = Py_NewRef(Py_None); // Failure!
}
- #line 2936 "Python/generated_cases.c.h"
+ #line 2982 "Python/generated_cases.c.h"
STACK_SHRINK(2);
stack_pointer[-1] = attrs;
DISPATCH();
@@ -2941,10 +2987,10 @@
TARGET(MATCH_MAPPING) {
PyObject *subject = stack_pointer[-1];
PyObject *res;
- #line 2070 "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 2948 "Python/generated_cases.c.h"
+ #line 2994 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = res;
PREDICT(POP_JUMP_IF_FALSE);
@@ -2954,10 +3000,10 @@
TARGET(MATCH_SEQUENCE) {
PyObject *subject = stack_pointer[-1];
PyObject *res;
- #line 2076 "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 2961 "Python/generated_cases.c.h"
+ #line 3007 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = res;
PREDICT(POP_JUMP_IF_FALSE);
@@ -2968,11 +3014,11 @@
PyObject *keys = stack_pointer[-1];
PyObject *subject = stack_pointer[-2];
PyObject *values_or_none;
- #line 2082 "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 2976 "Python/generated_cases.c.h"
+ #line 3022 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = values_or_none;
DISPATCH();
@@ -2981,14 +3027,14 @@
TARGET(GET_ITER) {
PyObject *iterable = stack_pointer[-1];
PyObject *iter;
- #line 2088 "Python/bytecodes.c"
+ #line 2119 "Python/bytecodes.c"
/* before: [obj]; after [getiter(obj)] */
iter = PyObject_GetIter(iterable);
- #line 2988 "Python/generated_cases.c.h"
+ #line 3034 "Python/generated_cases.c.h"
Py_DECREF(iterable);
- #line 2091 "Python/bytecodes.c"
+ #line 2122 "Python/bytecodes.c"
if (iter == NULL) goto pop_1_error;
- #line 2992 "Python/generated_cases.c.h"
+ #line 3038 "Python/generated_cases.c.h"
stack_pointer[-1] = iter;
DISPATCH();
}
@@ -2996,7 +3042,7 @@
TARGET(GET_YIELD_FROM_ITER) {
PyObject *iterable = stack_pointer[-1];
PyObject *iter;
- #line 2095 "Python/bytecodes.c"
+ #line 2126 "Python/bytecodes.c"
/* before: [obj]; after [getiter(obj)] */
if (PyCoro_CheckExact(iterable)) {
/* `iterable` is a coroutine */
@@ -3019,11 +3065,11 @@
if (iter == NULL) {
goto error;
}
- #line 3023 "Python/generated_cases.c.h"
+ #line 3069 "Python/generated_cases.c.h"
Py_DECREF(iterable);
- #line 2118 "Python/bytecodes.c"
+ #line 2149 "Python/bytecodes.c"
}
- #line 3027 "Python/generated_cases.c.h"
+ #line 3073 "Python/generated_cases.c.h"
stack_pointer[-1] = iter;
PREDICT(LOAD_CONST);
DISPATCH();
@@ -3034,7 +3080,7 @@
static_assert(INLINE_CACHE_ENTRIES_FOR_ITER == 1, "incorrect cache size");
PyObject *iter = stack_pointer[-1];
PyObject *next;
- #line 2137 "Python/bytecodes.c"
+ #line 2168 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
_PyForIterCache *cache = (_PyForIterCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -3065,7 +3111,7 @@
DISPATCH();
}
// Common case: no jump, leave it to the code generator
- #line 3069 "Python/generated_cases.c.h"
+ #line 3115 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = next;
next_instr += 1;
@@ -3073,7 +3119,7 @@
}
TARGET(INSTRUMENTED_FOR_ITER) {
- #line 2170 "Python/bytecodes.c"
+ #line 2201 "Python/bytecodes.c"
_Py_CODEUNIT *here = next_instr-1;
_Py_CODEUNIT *target;
PyObject *iter = TOP();
@@ -3099,14 +3145,14 @@
target = next_instr + INLINE_CACHE_ENTRIES_FOR_ITER + oparg + 1;
}
INSTRUMENTED_JUMP(here, target, PY_MONITORING_EVENT_BRANCH);
- #line 3103 "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 2198 "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);
@@ -3126,7 +3172,7 @@
DISPATCH();
end_for_iter_list:
// Common case: no jump, leave it to the code generator
- #line 3130 "Python/generated_cases.c.h"
+ #line 3176 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = next;
next_instr += 1;
@@ -3136,7 +3182,7 @@
TARGET(FOR_ITER_TUPLE) {
PyObject *iter = stack_pointer[-1];
PyObject *next;
- #line 2220 "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);
@@ -3156,7 +3202,7 @@
DISPATCH();
end_for_iter_tuple:
// Common case: no jump, leave it to the code generator
- #line 3160 "Python/generated_cases.c.h"
+ #line 3206 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = next;
next_instr += 1;
@@ -3166,7 +3212,7 @@
TARGET(FOR_ITER_RANGE) {
PyObject *iter = stack_pointer[-1];
PyObject *next;
- #line 2242 "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);
@@ -3184,7 +3230,7 @@
if (next == NULL) {
goto error;
}
- #line 3188 "Python/generated_cases.c.h"
+ #line 3234 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = next;
next_instr += 1;
@@ -3193,7 +3239,7 @@
TARGET(FOR_ITER_GEN) {
PyObject *iter = stack_pointer[-1];
- #line 2262 "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);
@@ -3208,14 +3254,14 @@
assert(next_instr[oparg].op.code == END_FOR ||
next_instr[oparg].op.code == INSTRUMENTED_END_FOR);
DISPATCH_INLINED(gen_frame);
- #line 3212 "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 2279 "Python/bytecodes.c"
+ #line 2310 "Python/bytecodes.c"
PyObject *enter = _PyObject_LookupSpecial(mgr, &_Py_ID(__aenter__));
if (enter == NULL) {
if (!_PyErr_Occurred(tstate)) {
@@ -3238,16 +3284,16 @@
Py_DECREF(enter);
goto error;
}
- #line 3242 "Python/generated_cases.c.h"
+ #line 3288 "Python/generated_cases.c.h"
Py_DECREF(mgr);
- #line 2302 "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 3251 "Python/generated_cases.c.h"
+ #line 3297 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = res;
stack_pointer[-2] = exit;
@@ -3259,7 +3305,7 @@
PyObject *mgr = stack_pointer[-1];
PyObject *exit;
PyObject *res;
- #line 2312 "Python/bytecodes.c"
+ #line 2343 "Python/bytecodes.c"
/* pop the context manager, push its __exit__ and the
* value returned from calling its __enter__
*/
@@ -3285,16 +3331,16 @@
Py_DECREF(enter);
goto error;
}
- #line 3289 "Python/generated_cases.c.h"
+ #line 3335 "Python/generated_cases.c.h"
Py_DECREF(mgr);
- #line 2338 "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 3298 "Python/generated_cases.c.h"
+ #line 3344 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = res;
stack_pointer[-2] = exit;
@@ -3306,7 +3352,7 @@
PyObject *lasti = stack_pointer[-3];
PyObject *exit_func = stack_pointer[-4];
PyObject *res;
- #line 2347 "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
@@ -3327,7 +3373,7 @@
res = PyObject_Vectorcall(exit_func, stack + 1,
3 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
if (res == NULL) goto error;
- #line 3331 "Python/generated_cases.c.h"
+ #line 3377 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = res;
DISPATCH();
@@ -3336,7 +3382,7 @@
TARGET(PUSH_EXC_INFO) {
PyObject *new_exc = stack_pointer[-1];
PyObject *prev_exc;
- #line 2370 "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;
@@ -3346,7 +3392,7 @@
}
assert(PyExceptionInstance_Check(new_exc));
exc_info->exc_value = Py_NewRef(new_exc);
- #line 3350 "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;
@@ -3360,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 2382 "Python/bytecodes.c"
+ #line 2413 "Python/bytecodes.c"
/* Cached method object */
PyTypeObject *self_cls = Py_TYPE(self);
assert(type_version != 0);
@@ -3377,7 +3423,7 @@
assert(_PyType_HasFeature(Py_TYPE(res2), Py_TPFLAGS_METHOD_DESCRIPTOR));
res = self;
assert(oparg & 1);
- #line 3381 "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; }
@@ -3391,7 +3437,7 @@
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
PyObject *descr = read_obj(&next_instr[5].cache);
- #line 2401 "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);
@@ -3401,7 +3447,7 @@
res2 = Py_NewRef(descr);
res = self;
assert(oparg & 1);
- #line 3405 "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; }
@@ -3415,7 +3461,7 @@
PyObject *res;
uint32_t type_version = read_u32(&next_instr[1].cache);
PyObject *descr = read_obj(&next_instr[5].cache);
- #line 2413 "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;
@@ -3429,7 +3475,7 @@
res2 = Py_NewRef(descr);
res = self;
assert(oparg & 1);
- #line 3433 "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; }
@@ -3438,16 +3484,16 @@
}
TARGET(KW_NAMES) {
- #line 2429 "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 3446 "Python/generated_cases.c.h"
+ #line 3492 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_CALL) {
- #line 2435 "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);
@@ -3460,7 +3506,7 @@
_PyCallCache *cache = (_PyCallCache *)next_instr;
INCREMENT_ADAPTIVE_COUNTER(cache->counter);
GO_TO_INSTRUCTION(CALL);
- #line 3464 "Python/generated_cases.c.h"
+ #line 3510 "Python/generated_cases.c.h"
}
TARGET(CALL) {
@@ -3470,7 +3516,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2480 "Python/bytecodes.c"
+ #line 2511 "Python/bytecodes.c"
int is_meth = method != NULL;
int total_args = oparg;
if (is_meth) {
@@ -3552,7 +3598,7 @@
Py_DECREF(args[i]);
}
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 3556 "Python/generated_cases.c.h"
+ #line 3602 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -3564,7 +3610,7 @@
TARGET(CALL_BOUND_METHOD_EXACT_ARGS) {
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
- #line 2568 "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);
@@ -3574,7 +3620,7 @@
PEEK(oparg + 2) = Py_NewRef(meth); // method
Py_DECREF(callable);
GO_TO_INSTRUCTION(CALL_PY_EXACT_ARGS);
- #line 3578 "Python/generated_cases.c.h"
+ #line 3624 "Python/generated_cases.c.h"
}
TARGET(CALL_PY_EXACT_ARGS) {
@@ -3583,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 2580 "Python/bytecodes.c"
+ #line 2611 "Python/bytecodes.c"
assert(kwnames == NULL);
DEOPT_IF(tstate->interp->eval_frame, CALL);
int is_meth = method != NULL;
@@ -3609,7 +3655,7 @@
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
frame->return_offset = 0;
DISPATCH_INLINED(new_frame);
- #line 3613 "Python/generated_cases.c.h"
+ #line 3659 "Python/generated_cases.c.h"
}
TARGET(CALL_PY_WITH_DEFAULTS) {
@@ -3617,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 2608 "Python/bytecodes.c"
+ #line 2639 "Python/bytecodes.c"
assert(kwnames == NULL);
DEOPT_IF(tstate->interp->eval_frame, CALL);
int is_meth = method != NULL;
@@ -3653,7 +3699,7 @@
JUMPBY(INLINE_CACHE_ENTRIES_CALL);
frame->return_offset = 0;
DISPATCH_INLINED(new_frame);
- #line 3657 "Python/generated_cases.c.h"
+ #line 3703 "Python/generated_cases.c.h"
}
TARGET(CALL_NO_KW_TYPE_1) {
@@ -3661,7 +3707,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *null = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2646 "Python/bytecodes.c"
+ #line 2677 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 1);
DEOPT_IF(null != NULL, CALL);
@@ -3671,7 +3717,7 @@
res = Py_NewRef(Py_TYPE(obj));
Py_DECREF(obj);
Py_DECREF(&PyType_Type); // I.e., callable
- #line 3675 "Python/generated_cases.c.h"
+ #line 3721 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -3684,7 +3730,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *null = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2658 "Python/bytecodes.c"
+ #line 2689 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 1);
DEOPT_IF(null != NULL, CALL);
@@ -3695,7 +3741,7 @@
Py_DECREF(arg);
Py_DECREF(&PyUnicode_Type); // I.e., callable
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 3699 "Python/generated_cases.c.h"
+ #line 3745 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -3709,7 +3755,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *null = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2672 "Python/bytecodes.c"
+ #line 2703 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 1);
DEOPT_IF(null != NULL, CALL);
@@ -3720,7 +3766,7 @@
Py_DECREF(arg);
Py_DECREF(&PyTuple_Type); // I.e., tuple
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 3724 "Python/generated_cases.c.h"
+ #line 3770 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -3734,7 +3780,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2686 "Python/bytecodes.c"
+ #line 2717 "Python/bytecodes.c"
int is_meth = method != NULL;
int total_args = oparg;
if (is_meth) {
@@ -3756,7 +3802,7 @@
}
Py_DECREF(tp);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 3760 "Python/generated_cases.c.h"
+ #line 3806 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -3770,7 +3816,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2711 "Python/bytecodes.c"
+ #line 2742 "Python/bytecodes.c"
/* Builtin METH_O functions */
assert(kwnames == NULL);
int is_meth = method != NULL;
@@ -3798,7 +3844,7 @@
Py_DECREF(arg);
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 3802 "Python/generated_cases.c.h"
+ #line 3848 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -3812,7 +3858,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2742 "Python/bytecodes.c"
+ #line 2773 "Python/bytecodes.c"
/* Builtin METH_FASTCALL functions, without keywords */
assert(kwnames == NULL);
int is_meth = method != NULL;
@@ -3844,7 +3890,7 @@
'invalid'). In those cases an exception is set, so we must
handle it.
*/
- #line 3848 "Python/generated_cases.c.h"
+ #line 3894 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -3858,7 +3904,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2777 "Python/bytecodes.c"
+ #line 2808 "Python/bytecodes.c"
/* Builtin METH_FASTCALL | METH_KEYWORDS functions */
int is_meth = method != NULL;
int total_args = oparg;
@@ -3890,7 +3936,7 @@
}
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 3894 "Python/generated_cases.c.h"
+ #line 3940 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -3904,7 +3950,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2812 "Python/bytecodes.c"
+ #line 2843 "Python/bytecodes.c"
assert(kwnames == NULL);
/* len(o) */
int is_meth = method != NULL;
@@ -3929,7 +3975,7 @@
Py_DECREF(callable);
Py_DECREF(arg);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 3933 "Python/generated_cases.c.h"
+ #line 3979 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -3942,7 +3988,7 @@
PyObject *callable = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2839 "Python/bytecodes.c"
+ #line 2870 "Python/bytecodes.c"
assert(kwnames == NULL);
/* isinstance(o, o2) */
int is_meth = method != NULL;
@@ -3969,7 +4015,7 @@
Py_DECREF(cls);
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 3973 "Python/generated_cases.c.h"
+ #line 4019 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -3981,7 +4027,7 @@
PyObject **args = (stack_pointer - oparg);
PyObject *self = stack_pointer[-(1 + oparg)];
PyObject *method = stack_pointer[-(2 + oparg)];
- #line 2869 "Python/bytecodes.c"
+ #line 2900 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 1);
assert(method != NULL);
@@ -3999,14 +4045,14 @@
JUMPBY(INLINE_CACHE_ENTRIES_CALL + 1);
assert(next_instr[-1].op.code == POP_TOP);
DISPATCH();
- #line 4003 "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 2889 "Python/bytecodes.c"
+ #line 2920 "Python/bytecodes.c"
assert(kwnames == NULL);
int is_meth = method != NULL;
int total_args = oparg;
@@ -4037,7 +4083,7 @@
Py_DECREF(arg);
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4041 "Python/generated_cases.c.h"
+ #line 4087 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4050,7 +4096,7 @@
PyObject **args = (stack_pointer - oparg);
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2923 "Python/bytecodes.c"
+ #line 2954 "Python/bytecodes.c"
int is_meth = method != NULL;
int total_args = oparg;
if (is_meth) {
@@ -4079,7 +4125,7 @@
}
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4083 "Python/generated_cases.c.h"
+ #line 4129 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4092,7 +4138,7 @@
PyObject **args = (stack_pointer - oparg);
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2955 "Python/bytecodes.c"
+ #line 2986 "Python/bytecodes.c"
assert(kwnames == NULL);
assert(oparg == 0 || oparg == 1);
int is_meth = method != NULL;
@@ -4121,7 +4167,7 @@
Py_DECREF(self);
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4125 "Python/generated_cases.c.h"
+ #line 4171 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4134,7 +4180,7 @@
PyObject **args = (stack_pointer - oparg);
PyObject *method = stack_pointer[-(2 + oparg)];
PyObject *res;
- #line 2987 "Python/bytecodes.c"
+ #line 3018 "Python/bytecodes.c"
assert(kwnames == NULL);
int is_meth = method != NULL;
int total_args = oparg;
@@ -4162,7 +4208,7 @@
}
Py_DECREF(callable);
if (res == NULL) { STACK_SHRINK(oparg); goto pop_2_error; }
- #line 4166 "Python/generated_cases.c.h"
+ #line 4212 "Python/generated_cases.c.h"
STACK_SHRINK(oparg);
STACK_SHRINK(1);
stack_pointer[-1] = res;
@@ -4172,9 +4218,9 @@
}
TARGET(INSTRUMENTED_CALL_FUNCTION_EX) {
- #line 3018 "Python/bytecodes.c"
+ #line 3049 "Python/bytecodes.c"
GO_TO_INSTRUCTION(CALL_FUNCTION_EX);
- #line 4178 "Python/generated_cases.c.h"
+ #line 4224 "Python/generated_cases.c.h"
}
TARGET(CALL_FUNCTION_EX) {
@@ -4183,7 +4229,7 @@
PyObject *callargs = stack_pointer[-(1 + ((oparg & 1) ? 1 : 0))];
PyObject *func = stack_pointer[-(2 + ((oparg & 1) ? 1 : 0))];
PyObject *result;
- #line 3022 "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));
@@ -4226,14 +4272,14 @@
else {
result = PyObject_Call(func, callargs, kwargs);
}
- #line 4230 "Python/generated_cases.c.h"
+ #line 4276 "Python/generated_cases.c.h"
Py_DECREF(func);
Py_DECREF(callargs);
Py_XDECREF(kwargs);
- #line 3065 "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 4237 "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;
@@ -4248,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 3075 "Python/bytecodes.c"
+ #line 3106 "Python/bytecodes.c"
PyFunctionObject *func_obj = (PyFunctionObject *)
PyFunction_New(codeobj, GLOBALS());
@@ -4277,14 +4323,14 @@
func_obj->func_version = ((PyCodeObject *)codeobj)->co_version;
func = (PyObject *)func_obj;
- #line 4281 "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 3106 "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);
@@ -4305,7 +4351,7 @@
frame = cframe.current_frame = prev;
_PyFrame_StackPush(frame, (PyObject *)gen);
goto resume_frame;
- #line 4309 "Python/generated_cases.c.h"
+ #line 4355 "Python/generated_cases.c.h"
}
TARGET(BUILD_SLICE) {
@@ -4313,15 +4359,15 @@
PyObject *stop = stack_pointer[-(1 + ((oparg == 3) ? 1 : 0))];
PyObject *start = stack_pointer[-(2 + ((oparg == 3) ? 1 : 0))];
PyObject *slice;
- #line 3129 "Python/bytecodes.c"
+ #line 3160 "Python/bytecodes.c"
slice = PySlice_New(start, stop, step);
- #line 4319 "Python/generated_cases.c.h"
+ #line 4365 "Python/generated_cases.c.h"
Py_DECREF(start);
Py_DECREF(stop);
Py_XDECREF(step);
- #line 3131 "Python/bytecodes.c"
+ #line 3162 "Python/bytecodes.c"
if (slice == NULL) { STACK_SHRINK(((oparg == 3) ? 1 : 0)); goto pop_2_error; }
- #line 4325 "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;
@@ -4332,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 3135 "Python/bytecodes.c"
+ #line 3166 "Python/bytecodes.c"
/* Handles f-string value formatting. */
PyObject *(*conv_fn)(PyObject *);
int which_conversion = oparg & FVC_MASK;
@@ -4367,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 4371 "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();
@@ -4376,10 +4422,10 @@
TARGET(COPY) {
PyObject *bottom = stack_pointer[-(1 + (oparg-1))];
PyObject *top;
- #line 3172 "Python/bytecodes.c"
+ #line 3203 "Python/bytecodes.c"
assert(oparg > 0);
top = Py_NewRef(bottom);
- #line 4383 "Python/generated_cases.c.h"
+ #line 4429 "Python/generated_cases.c.h"
STACK_GROW(1);
stack_pointer[-1] = top;
DISPATCH();
@@ -4391,7 +4437,7 @@
PyObject *rhs = stack_pointer[-1];
PyObject *lhs = stack_pointer[-2];
PyObject *res;
- #line 3177 "Python/bytecodes.c"
+ #line 3208 "Python/bytecodes.c"
#if ENABLE_SPECIALIZATION
_PyBinaryOpCache *cache = (_PyBinaryOpCache *)next_instr;
if (ADAPTIVE_COUNTER_IS_ZERO(cache->counter)) {
@@ -4406,12 +4452,12 @@
assert((unsigned)oparg < Py_ARRAY_LENGTH(binary_ops));
assert(binary_ops[oparg]);
res = binary_ops[oparg](lhs, rhs);
- #line 4410 "Python/generated_cases.c.h"
+ #line 4456 "Python/generated_cases.c.h"
Py_DECREF(lhs);
Py_DECREF(rhs);
- #line 3192 "Python/bytecodes.c"
+ #line 3223 "Python/bytecodes.c"
if (res == NULL) goto pop_2_error;
- #line 4415 "Python/generated_cases.c.h"
+ #line 4461 "Python/generated_cases.c.h"
STACK_SHRINK(1);
stack_pointer[-1] = res;
next_instr += 1;
@@ -4421,16 +4467,16 @@
TARGET(SWAP) {
PyObject *top = stack_pointer[-1];
PyObject *bottom = stack_pointer[-(2 + (oparg-2))];
- #line 3197 "Python/bytecodes.c"
+ #line 3228 "Python/bytecodes.c"
assert(oparg >= 2);
- #line 4427 "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 3201 "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(
@@ -4450,11 +4496,11 @@
}
opcode = original_opcode;
DISPATCH_GOTO();
- #line 4454 "Python/generated_cases.c.h"
+ #line 4500 "Python/generated_cases.c.h"
}
TARGET(INSTRUMENTED_INSTRUCTION) {
- #line 3223 "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;
@@ -4466,26 +4512,26 @@
assert(next_opcode > 0 && next_opcode < 256);
opcode = next_opcode;
DISPATCH_GOTO();
- #line 4470 "Python/generated_cases.c.h"
+ #line 4516 "Python/generated_cases.c.h"
}
TARGET(INSTRUMENTED_JUMP_FORWARD) {
- #line 3237 "Python/bytecodes.c"
+ #line 3268 "Python/bytecodes.c"
INSTRUMENTED_JUMP(next_instr-1, next_instr+oparg, PY_MONITORING_EVENT_JUMP);
- #line 4476 "Python/generated_cases.c.h"
+ #line 4522 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_JUMP_BACKWARD) {
- #line 3241 "Python/bytecodes.c"
+ #line 3272 "Python/bytecodes.c"
INSTRUMENTED_JUMP(next_instr-1, next_instr-oparg, PY_MONITORING_EVENT_JUMP);
- #line 4483 "Python/generated_cases.c.h"
+ #line 4529 "Python/generated_cases.c.h"
CHECK_EVAL_BREAKER();
DISPATCH();
}
TARGET(INSTRUMENTED_POP_JUMP_IF_TRUE) {
- #line 3246 "Python/bytecodes.c"
+ #line 3277 "Python/bytecodes.c"
PyObject *cond = POP();
int err = PyObject_IsTrue(cond);
Py_DECREF(cond);
@@ -4494,12 +4540,12 @@
assert(err == 0 || err == 1);
int offset = err*oparg;
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
- #line 4498 "Python/generated_cases.c.h"
+ #line 4544 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_POP_JUMP_IF_FALSE) {
- #line 3257 "Python/bytecodes.c"
+ #line 3288 "Python/bytecodes.c"
PyObject *cond = POP();
int err = PyObject_IsTrue(cond);
Py_DECREF(cond);
@@ -4508,12 +4554,12 @@
assert(err == 0 || err == 1);
int offset = (1-err)*oparg;
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
- #line 4512 "Python/generated_cases.c.h"
+ #line 4558 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_POP_JUMP_IF_NONE) {
- #line 3268 "Python/bytecodes.c"
+ #line 3299 "Python/bytecodes.c"
PyObject *value = POP();
_Py_CODEUNIT *here = next_instr-1;
int offset;
@@ -4526,12 +4572,12 @@
offset = 0;
}
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
- #line 4530 "Python/generated_cases.c.h"
+ #line 4576 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(INSTRUMENTED_POP_JUMP_IF_NOT_NONE) {
- #line 3283 "Python/bytecodes.c"
+ #line 3314 "Python/bytecodes.c"
PyObject *value = POP();
_Py_CODEUNIT *here = next_instr-1;
int offset;
@@ -4544,30 +4590,30 @@
offset = oparg;
}
INSTRUMENTED_JUMP(here, next_instr + offset, PY_MONITORING_EVENT_BRANCH);
- #line 4548 "Python/generated_cases.c.h"
+ #line 4594 "Python/generated_cases.c.h"
DISPATCH();
}
TARGET(EXTENDED_ARG) {
- #line 3298 "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 4559 "Python/generated_cases.c.h"
+ #line 4605 "Python/generated_cases.c.h"
}
TARGET(CACHE) {
- #line 3306 "Python/bytecodes.c"
+ #line 3337 "Python/bytecodes.c"
assert(0 && "Executing a cache.");
Py_UNREACHABLE();
- #line 4566 "Python/generated_cases.c.h"
+ #line 4612 "Python/generated_cases.c.h"
}
TARGET(RESERVED) {
- #line 3311 "Python/bytecodes.c"
+ #line 3342 "Python/bytecodes.c"
assert(0 && "Executing RESERVED instruction.");
Py_UNREACHABLE();
- #line 4573 "Python/generated_cases.c.h"
+ #line 4619 "Python/generated_cases.c.h"
}
diff --git a/Python/opcode_metadata.h b/Python/opcode_metadata.h
index 4681ed03af..fb370ef923 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_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_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_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 9d6616666f..0109182927 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_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,