File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -1176,6 +1176,18 @@ All of the following opcodes use their arguments.
1176
1176
.. versionadded :: 3.7
1177
1177
1178
1178
1179
+ .. opcode :: CALL_METHOD_KW (argc)
1180
+
1181
+ Calls a method in a similar fashion as :opcode: `CALL_METHOD `, but also supports keyword arguments.
1182
+ *argc * is the number of positional and keyword arguments.
1183
+ This opcode is designed to be used with :opcode: `LOAD_METHOD `. TOS is a
1184
+ tuple of keyword argument names. Argument values are below that.
1185
+ Below them, the two items described in :opcode: `LOAD_METHOD ` are on the
1186
+ stack (either ``self `` and an unbound method object or ``NULL `` and an
1187
+ arbitrary callable). All of them are popped from the stack and the return value is pushed.
1188
+
1189
+ .. versionadded :: 3.11
1190
+
1179
1191
.. opcode :: MAKE_FUNCTION (flags)
1180
1192
1181
1193
Pushes a new function object on the stack. From bottom to top, the consumed
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ Improved Modules
90
90
Optimizations
91
91
=============
92
92
93
- * Compiler optimizes now simple C-style formatting with literal format
93
+ * Compiler now optimizes simple C-style formatting with literal format
94
94
containing only format codes ``%s ``, ``%r `` and ``%a `` and makes it as
95
95
fast as corresponding f-string expression.
96
96
(Contributed by Serhiy Storchaka in :issue: `28307 `.)
@@ -99,6 +99,20 @@ Optimizations
99
99
almost eliminated when no exception is raised.
100
100
(Contributed by Mark Shannon in :issue: `40222 `.)
101
101
102
+ * Method calls with keywords are now faster due to bytecode
103
+ changes which avoid creating bound method instances. Previously, this
104
+ optimization was applied only to method calls with purely positional
105
+ arguments.
106
+ (Contributed by Ken Jin and Mark Shannon in :issue: `26110 `, based on ideas
107
+ implemented in PyPy.)
108
+
109
+ CPython bytecode changes
110
+ ========================
111
+
112
+ * Added a new :opcode: `CALL_METHOD_KW ` opcode. Calls a method in a similar
113
+ fashion as :opcode: `CALL_METHOD `, but also supports keyword arguments. Works
114
+ in tandem with :opcode: `LOAD_METHOD `.
115
+
102
116
103
117
Build Changes
104
118
=============
You can’t perform that action at this time.
0 commit comments