@@ -75,7 +75,8 @@ the following command can be used to display the disassembly of
7575 >>> dis.dis(myfunc)
7676 2 RESUME 0
7777 <BLANKLINE>
78- 3 LOAD_GLOBAL 1 (len + NULL)
78+ 3 LOAD_GLOBAL 0 (len)
79+ PUSH_NULL
7980 LOAD_FAST 0 (alist)
8081 CALL 1
8182 RETURN_VALUE
@@ -207,6 +208,7 @@ Example:
207208 ...
208209 RESUME
209210 LOAD_GLOBAL
211+ PUSH_NULL
210212 LOAD_FAST
211213 CALL
212214 RETURN_VALUE
@@ -1215,21 +1217,28 @@ iterations of the loop.
12151217
12161218.. opcode :: LOAD_ATTR (namei)
12171219
1218- If the low bit of ``namei `` is not set, this replaces ``STACK[-1] `` with
1219- ``getattr(STACK[-1], co_names[namei>>1]) ``.
1220+ Replaces ``STACK[-1] `` with ``getattr(STACK[-1], co_names[namei>>1]) ``.
12201221
1221- If the low bit of ``namei `` is set, this will attempt to load a method named
1222- ``co_names[namei>>1] `` from the ``STACK[-1] `` object. ``STACK[-1] `` is popped.
1222+ .. versionchanged :: 3.12
1223+ If the low bit of ``namei `` is set, then a ``NULL `` or ``self `` is
1224+ pushed to the stack before the attribute or unbound method respectively.
1225+
1226+ .. versionchanged :: 3.14
1227+ Reverted change from 3.12. The low bit of ``namei `` has no special meaning.
1228+
1229+
1230+ .. opcode :: LOAD_METHOD (namei)
1231+
1232+ Attempt to load a method named ``co_names[namei>>1] `` from the ``STACK[-1] `` object.
1233+ ``STACK[-1] `` is popped.
12231234 This bytecode distinguishes two cases: if ``STACK[-1] `` has a method with the
12241235 correct name, the bytecode pushes the unbound method and ``STACK[-1] ``.
12251236 ``STACK[-1] `` will be used as the first argument (``self ``) by :opcode: `CALL `
12261237 or :opcode: `CALL_KW ` when calling the unbound method.
12271238 Otherwise, ``NULL `` and the object returned by
12281239 the attribute lookup are pushed.
12291240
1230- .. versionchanged :: 3.12
1231- If the low bit of ``namei `` is set, then a ``NULL `` or ``self `` is
1232- pushed to the stack before the attribute or unbound method respectively.
1241+ .. versionadded :: 3.14
12331242
12341243
12351244.. opcode :: LOAD_SUPER_ATTR (namei)
@@ -1926,12 +1935,6 @@ but are replaced by real opcodes or removed before bytecode is generated.
19261935 This opcode is now a pseudo-instruction.
19271936
19281937
1929- .. opcode :: LOAD_METHOD
1930-
1931- Optimized unbound method lookup. Emitted as a ``LOAD_ATTR `` opcode
1932- with a flag set in the arg.
1933-
1934-
19351938.. _opcode_collections :
19361939
19371940Opcode collections
0 commit comments