Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add docs
  • Loading branch information
iritkatriel committed Oct 29, 2023
commit 801dbd52b2be0417ca020e0d644212dc94b934dd
12 changes: 9 additions & 3 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -1633,12 +1635,16 @@ iterations of the loop.

* ``0`` The start of a function, which is neither a generator, coroutine
nor an async generator
* ``1`` After a ``yield`` expression
* ``2`` After a ``yield from`` expression
* ``3`` After an ``await`` expression
* ``1`` After a ``yield`` expression, with except-depth > 1
* ``2`` After a ``yield`` expression, with except-depth 1
* ``3`` After a ``yield from`` expression
* ``4`` After an ``await`` expression

.. versionadded:: 3.11

.. versionchanged:: 3.13
new oparg value for ``RESUME`` after ``YIELD_VALUE`` with except-depth of 1


.. opcode:: RETURN_GENERATOR

Expand Down
9 changes: 9 additions & 0 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,15 @@ Others

* None yet

CPython bytecode changes
========================

* ``YIELD_VALUE`` no longer has an oparg. The set of possible values
for the oparg of ``RESUME`` was changed to add a new value which
identifies a ``RESUME`` that follows a ``YIELD_VALUE`` which is at
except-depth of 1. (This is needed to optimize closing of generators.)
(Contributed by Irit Katriel in :gh:`111354`.)

Porting to Python 3.13
======================

Expand Down
2 changes: 1 addition & 1 deletion Lib/importlib/_bootstrap_external.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ def _write_atomic(path, data, mode=0o666):
# Python 3.13a1 3561 (Add cache entry to branch instructions)
# Python 3.13a1 3562 (Assign opcode IDs for internal ops in separate range)
# Python 3.13a1 3563 (Add CALL_KW and remove KW_NAMES)
# Python 3.13a1 3564 (Shifted some of the oparg values of RESUME to add a new one)
# Python 3.13a1 3564 (Removed oparg from YIELD_VALUE, changed oparg values of RESUME)

# Python 3.14 will start with 3600

Expand Down