| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0a6412f commit ab61d3f
44 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -75,7 +75,8 @@ the following command can be used to display the disassembly of | |||
| 75 | 75 | >>> dis.dis(myfunc) | |
| 76 | 76 | 2 RESUME 0 | |
| 77 | 77 | <BLANKLINE> | |
| 78 | - 3 LOAD_GLOBAL 1 (len + NULL) | ||
| 78 | + 3 LOAD_GLOBAL 0 (len) | ||
| 79 | + PUSH_NULL | ||
| 79 | 80 | LOAD_FAST 0 (alist) | |
| 80 | 81 | CALL 1 | |
| 81 | 82 | RETURN_VALUE | |
@@ -207,6 +208,7 @@ Example: | |||
| 207 | 208 | ... | |
| 208 | 209 | RESUME | |
| 209 | 210 | LOAD_GLOBAL | |
| 211 | + PUSH_NULL | ||
| 210 | 212 | LOAD_FAST | |
| 211 | 213 | CALL | |
| 212 | 214 | RETURN_VALUE | |
@@ -1215,21 +1217,28 @@ iterations of the loop. | |||
| 1215 | 1217 | ||
| 1216 | 1218 | .. opcode:: LOAD_ATTR (namei) | |
| 1217 | 1219 | ||
| 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])``. | ||
| 1220 | 1221 | ||
| 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. | ||
| 1223 | 1234 | This bytecode distinguishes two cases: if ``STACK[-1]`` has a method with the | |
| 1224 | 1235 | correct name, the bytecode pushes the unbound method and ``STACK[-1]``. | |
| 1225 | 1236 | ``STACK[-1]`` will be used as the first argument (``self``) by :opcode:`CALL` | |
| 1226 | 1237 | or :opcode:`CALL_KW` when calling the unbound method. | |
| 1227 | 1238 | Otherwise, ``NULL`` and the object returned by | |
| 1228 | 1239 | the attribute lookup are pushed. | |
| 1229 | 1240 | ||
| 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 | ||
| 1233 | 1242 | ||
| 1234 | 1243 | ||
| 1235 | 1244 | .. opcode:: LOAD_SUPER_ATTR (namei) | |
@@ -1926,12 +1935,6 @@ but are replaced by real opcodes or removed before bytecode is generated. | |||
| 1926 | 1935 | This opcode is now a pseudo-instruction. | |
| 1927 | 1936 | ||
| 1928 | 1937 | ||
| 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 | - | ||
| 1935 | 1938 | .. _opcode_collections: | |
| 1936 | 1939 | ||
| 1937 | 1940 | Opcode collections | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -334,6 +334,8 @@ extern void _Py_Specialize_LoadSuperAttr(_PyStackRef global_super, _PyStackRef c | |||
| 334 | 334 | _Py_CODEUNIT *instr, int load_method); | |
| 335 | 335 | extern void _Py_Specialize_LoadAttr(_PyStackRef owner, _Py_CODEUNIT *instr, | |
| 336 | 336 | PyObject *name); | |
| 337 | + extern void _Py_Specialize_LoadMethod(_PyStackRef owner, _Py_CODEUNIT *instr, | ||
| 338 | + PyObject *name); | ||
| 337 | 339 | extern void _Py_Specialize_StoreAttr(_PyStackRef owner, _Py_CODEUNIT *instr, | |
| 338 | 340 | PyObject *name); | |
| 339 | 341 | extern void _Py_Specialize_LoadGlobal(PyObject *globals, PyObject *builtins, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -267,6 +267,7 @@ Known values: | |||
| 267 | 267 | Python 3.14a4 3612 (Add POP_ITER and INSTRUMENTED_POP_ITER) | |
| 268 | 268 | Python 3.14a4 3613 (Add LOAD_CONST_MORTAL instruction) | |
| 269 | 269 | Python 3.14a5 3614 (Add BINARY_OP_EXTEND) | |
| 270 | + Python 3.14a5 3615 (Remove conditional stack effects) | ||
| 270 | 271 | ||
| 271 | 272 | Python 3.15 will start with 3650 | |
| 272 | 273 | ||
@@ -279,7 +280,7 @@ PC/launcher.c must also be updated. | |||
| 279 | 280 | ||
| 280 | 281 | */ | |
| 281 | 282 | ||
| 282 | - #define PYC_MAGIC_NUMBER 3614 | ||
| 283 | + #define PYC_MAGIC_NUMBER 3615 | ||
| 283 | 284 | /* This is equivalent to converting PYC_MAGIC_NUMBER to 2 bytes | |
| 284 | 285 | (little-endian) and then appending b'\r\n'. */ | |
| 285 | 286 | #define PYC_MAGIC_NUMBER_TOKEN \ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments