Skip to content

Commit 4abfa36

Browse files
committed
Copyedit 3.14 What's New: CPython bytecode changes
1 parent 519bc47 commit 4abfa36

1 file changed

Lines changed: 64 additions & 1 deletion

File tree

Doc/whatsnew/3.14.rst

Lines changed: 64 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2800,9 +2800,72 @@ Deprecated
28002800
CPython bytecode changes
28012801
========================
28022802

2803-
* Replaced the opcode ``BINARY_SUBSCR`` by :opcode:`BINARY_OP` with oparg ``NB_SUBSCR``.
2803+
* Add the :opcode:`!ANNOTATIONS_PLACEHOLDER` pseudo instruction
2804+
to support partially executed module-level annotations with
2805+
:ref:`deferred evaluation of annotations <whatsnew314-pep649>`.
2806+
(Contributed by Jelle Zijlstra in :gh:`130907`.)
2807+
2808+
* Add the :opcode:`BINARY_OP_EXTEND` opcode, which executes a pair of functions
2809+
(guard and specialization functions) accessed from the inline cache.
2810+
(Contributed by Irit Katriel in :gh:`100239`.)
2811+
2812+
* Replaced the opcode :opcode:`!BINARY_SUBSCR` by :opcode:`BINARY_OP`
2813+
with oparg ``NB_SUBSCR``.
28042814
(Contributed by Irit Katriel in :gh:`100239`.)
28052815

2816+
* Add the :opcode:`BUILD_INTERPOLATION` & :opcode:`BUILD_TEMPLATE`
2817+
opcodes to construct new :class:`~string.templatelib.Interpolation`
2818+
and :class:`~string.templatelib.Template` instances, respectively.
2819+
(Contributed by Lysandros Nikolaou and others in :gh:`132661`;
2820+
see also :ref:`PEP 750: Template strings <whatsnew314-pep750>`).
2821+
2822+
* Remove the :opcode:`!BUILD_CONST_KEY_MAP` opcode.
2823+
Use :opcode:`BUILD_MAP` instead.
2824+
(Contributed by Mark Shannon in :gh:`122160`.)
2825+
2826+
* Add three specialisations for :opcode:`CALL_KW`;
2827+
:opcode:`!CALL_KW_PY` for calls to Python functions,
2828+
:opcode:`!CALL_KW_BOUND_METHOD` for calls to bound methods, and
2829+
:opcode:`!CALL_KW_NON_PY` for all other calls.
2830+
(Contributed by Mark Shannon in :gh:`118093`.)
2831+
2832+
* Add the :opcode:`!JUMP_IF_TRUE` and :opcode:`!JUMP_IF_FALSE` pseudo instructions,
2833+
conditional jumps which do not impact the stack.
2834+
Replaced by the sequence ``COPY 1``, ``TO_BOOL``, ``POP_JUMP_IF_TRUE/FALSE``.
2835+
(Contributed by Irit Katriel in :gh:`124285`.)
2836+
2837+
* Replace the :opcode:`!LOAD_ASSERTION_ERROR` opcode with
2838+
:opcode:`LOAD_COMMON_CONSTANT` and add support for loading
2839+
:exc:`NotImplementedError`.
2840+
2841+
* Add the :opcode:`LOAD_CONST_MORTAL` opcode.
2842+
(Contributed by Mark Shannon in :gh:`128685`.)
2843+
2844+
* Add the :opcode:`LOAD_FAST_BORROW` & :opcode:`LOAD_FAST_BORROW_LOAD_FAST_BORROW`
2845+
opcodes to reduce reference counting overhead when the interpreter can prove
2846+
that the reference in the frame outlives the reference loaded onto the stack.
2847+
(Contributed by Matt Page in :gh:`130704`.)
2848+
2849+
* Add the :opcode:`LOAD_SMALL_INT` and :opcode:`LOAD_CONST_IMMORTAL` opcodes.
2850+
:opcode:`!LOAD_SMALL_INT` pushes a small integer equal to the ``oparg`` to the stack.
2851+
:opcode:`!LOAD_CONST_IMMORTAL` does the same as :opcode:`!LOAD_CONST`,
2852+
but is more efficient for immortal objects.
2853+
The :opcode:`!RETURN_CONST` opcode is removed as it is no longer used.
2854+
(Contributed by Mark Shannon in :gh:`125837`.)
2855+
2856+
* Add the new :opcode:`LOAD_SPECIAL` instruction.
2857+
Generate code for :keyword:`with` and :keyword:`async with` statements
2858+
using the new instruction.
2859+
Removed the :opcode:`!BEFORE_WITH` and :opcode:`!BEFORE_ASYNC_WITH` instructions.
2860+
(Contributed by Mark Shannon in :gh:`120507`.)
2861+
2862+
* Add the :opcode:`NOT_TAKEN` opcode, used by :mod:`sys.monitoring` to record
2863+
:monitoring-event:`branch events <BRANCH_LEFT>`.
2864+
(Contributed by Mark Shannon in :gh:`122548`.)
2865+
2866+
* Add the :opcode:`POP_ITER` opcode to support 'virtual' iterators.
2867+
(Contributed by Mark Shannon in :gh:`132554`.)
2868+
28062869

28072870
C API changes
28082871
=============

0 commit comments

Comments
 (0)