@@ -887,7 +887,20 @@ iterations of the loop.
887
887
888
888
.. opcode :: LOAD_ATTR (namei)
889
889
890
- Replaces TOS with ``getattr(TOS, co_names[namei]) ``.
890
+ If the low bit of ``namei `` is not set, this replaces TOS with
891
+ ``getattr(TOS, co_names[namei>>1]) ``.
892
+
893
+ If the low bit of ``namei `` is set, this will attempt to load a method named
894
+ ``co_names[namei>>1] `` from the TOS object. TOS is popped.
895
+ This bytecode distinguishes two cases: if TOS has a method with the correct
896
+ name, the bytecode pushes the unbound method and TOS. TOS will be used as
897
+ the first argument (``self ``) by :opcode: `CALL ` when calling the
898
+ unbound method. Otherwise, ``NULL `` and the object return by the attribute
899
+ lookup are pushed.
900
+
901
+ .. versionchanged :: 3.11
902
+ If the low bit of ``namei `` is set, then a ``NULL `` or ``self `` is
903
+ pushed to the stack before the attribute or unbound method respectively.
891
904
892
905
893
906
.. opcode :: COMPARE_OP (opname)
@@ -1189,18 +1202,6 @@ iterations of the loop.
1189
1202
.. versionadded :: 3.6
1190
1203
1191
1204
1192
- .. opcode :: LOAD_METHOD (namei)
1193
-
1194
- Loads a method named ``co_names[namei] `` from the TOS object. TOS is popped.
1195
- This bytecode distinguishes two cases: if TOS has a method with the correct
1196
- name, the bytecode pushes the unbound method and TOS. TOS will be used as
1197
- the first argument (``self ``) by :opcode: `CALL ` when calling the
1198
- unbound method. Otherwise, ``NULL `` and the object return by the attribute
1199
- lookup are pushed.
1200
-
1201
- .. versionadded :: 3.7
1202
-
1203
-
1204
1205
.. opcode :: PUSH_NULL
1205
1206
1206
1207
Pushes a ``NULL `` to the stack.
0 commit comments