diff options
author | Mark Shannon <mark@hotpy.org> | 2024-10-29 11:15:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-29 11:15:42 (GMT) |
commit | faa3272fb8d63d481a136cc0467a0cba6ed7b264 (patch) | |
tree | 474ac9edbff637a8edb280846a1d3d9b113915c4 /Doc | |
parent | 67f5c5bd6fcc956a785edef3be67e8cbe470cd31 (diff) | |
download | cpython-faa3272fb8d63d481a136cc0467a0cba6ed7b264.zip cpython-faa3272fb8d63d481a136cc0467a0cba6ed7b264.tar.gz cpython-faa3272fb8d63d481a136cc0467a0cba6ed7b264.tar.bz2 |
GH-125837: Split `LOAD_CONST` into three. (GH-125972)
* Add LOAD_CONST_IMMORTAL opcode
* Add LOAD_SMALL_INT opcode
* Remove RETURN_CONST opcode
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/dis.rst | 23 | ||||
-rw-r--r-- | Doc/whatsnew/3.12.rst | 2 |
2 files changed, 17 insertions, 8 deletions
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index a2e44e0..6c12d1b 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -862,13 +862,6 @@ iterations of the loop. Returns with ``STACK[-1]`` to the caller of the function. -.. opcode:: RETURN_CONST (consti) - - Returns with ``co_consts[consti]`` to the caller of the function. - - .. versionadded:: 3.12 - - .. opcode:: YIELD_VALUE Yields ``STACK.pop()`` from a :term:`generator`. @@ -1086,6 +1079,22 @@ iterations of the loop. Pushes ``co_consts[consti]`` onto the stack. +.. opcode:: LOAD_SMALL_INT (i) + + Pushes the integer ``i`` onto the stack. + ``i`` must be in ``range(256)`` + + .. versionadded:: 3.14 + + +.. opcode:: LOAD_CONST_IMMORTAL (consti) + + Pushes ``co_consts[consti]`` onto the stack. + Can be used when the constant value is known to be immortal. + + .. versionadded:: 3.14 + + .. opcode:: LOAD_NAME (namei) Pushes the value associated with ``co_names[namei]`` onto the stack. diff --git a/Doc/whatsnew/3.12.rst b/Doc/whatsnew/3.12.rst index 463fc26..1354355 100644 --- a/Doc/whatsnew/3.12.rst +++ b/Doc/whatsnew/3.12.rst @@ -1123,7 +1123,7 @@ CPython bytecode changes * Add the :opcode:`LOAD_SUPER_ATTR` instruction. (Contributed by Carl Meyer and Vladimir Matveev in :gh:`103497`.) -* Add the :opcode:`RETURN_CONST` instruction. (Contributed by Wenyang Wang in :gh:`101632`.) +* Add the ``RETURN_CONST`` instruction. (Contributed by Wenyang Wang in :gh:`101632`.) Demos and Tools =============== |