@@ -1259,13 +1259,18 @@ iterations of the loop.
1259
1259
correct name, the bytecode pushes the unbound method and ``STACK[-1] ``.
1260
1260
``STACK[-1] `` will be used as the first argument (``self ``) by :opcode: `CALL `
1261
1261
or :opcode: `CALL_KW ` when calling the unbound method.
1262
- Otherwise, `` NULL `` and the object returned by
1263
- the attribute lookup are pushed .
1262
+ Otherwise, the object returned by the attribute lookup and `` NULL `` are
1263
+ pushed (in that order) .
1264
1264
1265
1265
.. versionchanged :: 3.12
1266
- If the low bit of ``namei `` is set, then a ``NULL `` or ``self `` is
1266
+ If the low bit of ``namei `` is set, then a ``NULL `` or ``self `` was
1267
1267
pushed to the stack before the attribute or unbound method respectively.
1268
1268
1269
+ .. versionchanged :: 3.13
1270
+ The push order changed to keep the callable at a fixed stack position for
1271
+ :opcode: `CALL `: the attribute or unbound method is now pushed before the
1272
+ ``NULL ``/``self `` marker (previously the marker was pushed first).
1273
+
1269
1274
1270
1275
.. opcode :: LOAD_SUPER_ATTR (namei)
1271
1276
@@ -1283,14 +1288,20 @@ iterations of the loop.
1283
1288
except that ``namei `` is shifted left by 2 bits instead of 1.
1284
1289
1285
1290
The low bit of ``namei `` signals to attempt a method load, as with
1286
- :opcode: `LOAD_ATTR `, which results in pushing ``NULL `` and the loaded method.
1291
+ :opcode: `LOAD_ATTR `, which results in pushing the loaded method and ``NULL ``
1292
+ (in that order).
1287
1293
When it is unset a single value is pushed to the stack.
1288
1294
1289
1295
The second-low bit of ``namei ``, if set, means that this was a two-argument
1290
1296
call to :func: `super ` (unset means zero-argument).
1291
1297
1292
1298
.. versionadded :: 3.12
1293
1299
1300
+ .. versionchanged :: 3.13
1301
+ The push order for method loads changed to keep the callable at a fixed
1302
+ stack position for :opcode: `CALL `: the loaded method is now pushed before
1303
+ the ``NULL `` marker (previously the marker was pushed first).
1304
+
1294
1305
1295
1306
.. opcode :: COMPARE_OP (opname)
1296
1307
@@ -1422,6 +1433,11 @@ iterations of the loop.
1422
1433
If the low bit of ``namei `` is set, then a ``NULL `` is pushed to the
1423
1434
stack before the global variable.
1424
1435
1436
+ .. versionchanged :: 3.13
1437
+ The push order changed to keep the callable at a fixed stack position for
1438
+ :opcode: `CALL `: the global is now pushed before the ``NULL `` marker
1439
+ (previously the marker was pushed first).
1440
+
1425
1441
.. opcode :: LOAD_FAST (var_num)
1426
1442
1427
1443
Pushes a reference to the local ``co_varnames[var_num] `` onto the stack.
0 commit comments