@@ -34,10 +34,13 @@ the following command can be used to display the disassembly of
3434:func: `myfunc `::
3535
3636 >>> dis.dis(myfunc)
37- 2 0 LOAD_GLOBAL 0 (len)
38- 2 LOAD_FAST 0 (alist)
39- 4 CALL_NO_KW 1
40- 6 RETURN_VALUE
37+ 1 0 RESUME 0
38+
39+ 2 2 LOAD_GLOBAL 0 (len)
40+ 4 LOAD_FAST 0 (alist)
41+ 6 PRECALL_FUNCTION 1
42+ 8 CALL 0
43+ 10 RETURN_VALUE
4144
4245(The "2" is a line number).
4346
@@ -102,9 +105,11 @@ Example::
102105 >>> for instr in bytecode:
103106 ... print(instr.opname)
104107 ...
108+ RESUME
105109 LOAD_GLOBAL
106110 LOAD_FAST
107- CALL_NO_KW
111+ PRECALL_FUNCTION
112+ CALL
108113 RETURN_VALUE
109114
110115
@@ -617,7 +622,7 @@ iterations of the loop.
617622.. opcode :: LOAD_BUILD_CLASS
618623
619624 Pushes :func: `builtins.__build_class__ ` onto the stack. It is later called
620- by :opcode: ` CALL_NO_KW ` to construct a class.
625+ to construct a class.
621626
622627
623628.. opcode :: BEFORE_WITH (delta)
@@ -1058,30 +1063,19 @@ iterations of the loop.
10581063 with ``__cause__ `` set to ``TOS ``)
10591064
10601065
1061- .. opcode :: CALL_NO_KW (argc)
1062-
1063- Calls a callable object with positional arguments.
1064- *argc * indicates the number of positional arguments.
1065- The top of the stack contains positional arguments, with the right-most
1066- argument on top. Below the arguments is a callable object to call.
1067- ``CALL_NO_KW `` pops all arguments and the callable object off the stack,
1068- calls the callable object with those arguments, and pushes the return value
1069- returned by the callable object.
1070-
1071- .. versionadded :: 3.11
1066+ .. opcode :: CALL (named)
10721067
1068+ Calls a callable object with the number of positional arguments specified by
1069+ the preceding :opcode: `PRECALL_FUNCTION ` or :opcode: `PRECALL_METHOD ` and
1070+ the named arguments specified by the preceding :opcode: `KW_NAMES `, if any.
1071+ *named * indicates the number of named arguments.
1072+ On the stack are (in ascending order):
10731073
1074- .. opcode :: CALL_KW (argc)
1074+ * The callable
1075+ * The positional arguments
1076+ * The named arguments
10751077
1076- Calls a callable object with positional (if any) and keyword arguments.
1077- *argc * indicates the total number of positional and keyword arguments.
1078- The top element on the stack contains a tuple with the names of the
1079- keyword arguments, which must be strings.
1080- Below that are the values for the keyword arguments,
1081- in the order corresponding to the tuple.
1082- Below that are positional arguments, with the right-most parameter on
1083- top. Below the arguments is a callable object to call.
1084- ``CALL_KW `` pops all arguments and the callable object off the stack,
1078+ ``CALL `` pops all arguments and the callable object off the stack,
10851079 calls the callable object with those arguments, and pushes the return value
10861080 returned by the callable object.
10871081
@@ -1108,7 +1102,7 @@ iterations of the loop.
11081102 Loads a method named ``co_names[namei] `` from the TOS object. TOS is popped.
11091103 This bytecode distinguishes two cases: if TOS has a method with the correct
11101104 name, the bytecode pushes the unbound method and TOS. TOS will be used as
1111- the first argument (``self ``) by :opcode: `CALL_METHOD ` when calling the
1105+ the first argument (``self ``) by :opcode: `PRECALL_METHOD ` when calling the
11121106 unbound method. Otherwise, ``NULL `` and the object return by the attribute
11131107 lookup are pushed.
11141108
@@ -1117,14 +1111,30 @@ iterations of the loop.
11171111
11181112.. opcode :: PRECALL_METHOD (argc)
11191113
1120- Prefixes either :opcode: `CALL_NO_KW ` or :opcode: ` CALL_KW ` .
1114+ Prefixes :opcode: `CALL ` (possibly with an intervening `` KW_NAMES ``) .
11211115 This opcode is designed to be used with :opcode: `LOAD_METHOD `.
1122- Sets internal variables, so that :opcode: `CALL_NO_KW ` or :opcode: ` CALL_KW `
1116+ Sets internal variables, so that :opcode: `CALL `
11231117 clean up after :opcode: `LOAD_METHOD ` correctly.
11241118
11251119 .. versionadded :: 3.11
11261120
11271121
1122+ .. opcode :: PRECALL_FUNCTION (args)
1123+
1124+ Prefixes :opcode: `CALL ` (possibly with an intervening ``KW_NAMES ``).
1125+ Sets internal variables, so that :opcode: `CALL ` can execute correctly.
1126+
1127+ .. versionadded :: 3.11
1128+
1129+
1130+ .. opcode :: KW_NAMES (i)
1131+
1132+ Stores a reference to ``co_consts[consti] `` into an internal variable
1133+ for use by :opcode: `CALL `. ``co_consts[consti] `` must be a tuple of strings.
1134+
1135+ .. versionadded :: 3.11
1136+
1137+
11281138.. opcode :: MAKE_FUNCTION (flags)
11291139
11301140 Pushes a new function object on the stack. From bottom to top, the consumed
0 commit comments