diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-11-02 10:18:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-02 10:18:43 (GMT) |
commit | 52cc4af6ae9002f11605f91b672746c127494efd (patch) | |
tree | 1bb4c679b3e179fdb9ccbacff4316c98fd594e79 /Doc | |
parent | 970e719a7a829bddc647bbaa668dd8603abdddef (diff) | |
download | cpython-52cc4af6ae9002f11605f91b672746c127494efd.zip cpython-52cc4af6ae9002f11605f91b672746c127494efd.tar.gz cpython-52cc4af6ae9002f11605f91b672746c127494efd.tar.bz2 |
gh-111354: simplify detection of RESUME after YIELD_VALUE at except-depth 1 (#111459)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/dis.rst | 13 | ||||
-rw-r--r-- | Doc/whatsnew/3.13.rst | 8 |
2 files changed, 19 insertions, 2 deletions
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index 7c92360..1a5ca16 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -823,6 +823,8 @@ iterations of the loop. .. versionchanged:: 3.12 oparg set to be the exception block depth, for efficient closing of generators. + .. versionchanged:: 3.13 + this opcode no longer has an oparg .. opcode:: SETUP_ANNOTATIONS @@ -1625,11 +1627,12 @@ iterations of the loop. success (``True``) or failure (``False``). -.. opcode:: RESUME (where) +.. opcode:: RESUME (context) A no-op. Performs internal tracing, debugging and optimization checks. - The ``where`` operand marks where the ``RESUME`` occurs: + The ``context`` oparand consists of two parts. The lowest two bits + indicate where the ``RESUME`` occurs: * ``0`` The start of a function, which is neither a generator, coroutine nor an async generator @@ -1637,8 +1640,14 @@ iterations of the loop. * ``2`` After a ``yield from`` expression * ``3`` After an ``await`` expression + The next bit is ``1`` if the RESUME is at except-depth ``1``, and ``0`` + otherwise. + .. versionadded:: 3.11 + .. versionchanged:: 3.13 + The oparg value changed to include information about except-depth + .. opcode:: RETURN_GENERATOR diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index e5f39c5..5ada880 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -945,6 +945,14 @@ Others * None yet +CPython bytecode changes +======================== + +* ``YIELD_VALUE`` no longer has an oparg. The oparg of ``RESUME`` was + changed to add a bit indicating whether the except-depth is 1, which + is needed to optimize closing of generators. + (Contributed by Irit Katriel in :gh:`111354`.) + Porting to Python 3.13 ====================== |