Skip to content

Commit 745238c

Browse files
committed
gh-140205: Add a description of SEND_GEN to the dis module.
1 parent 37d16f7 commit 745238c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Doc/library/dis.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,6 +1809,22 @@ iterations of the loop.
18091809
.. versionadded:: 3.11
18101810

18111811

1812+
.. opcode:: SEND_GEN (delta)
1813+
1814+
Specialized version of :opcode:`SEND` for generator and coroutine objects.
1815+
This is an optimized form that directly executes the generator frame without
1816+
the overhead of a full method call.
1817+
1818+
Equivalent to ``STACK[-1] = STACK[-2].send(STACK[-1])`` when ``STACK[-2]``
1819+
is a generator or coroutine object in a valid state.
1820+
1821+
If the call raises :exc:`StopIteration`, pop the top value from the stack,
1822+
push the exception's ``value`` attribute, and increment the bytecode counter
1823+
by *delta*.
1824+
1825+
.. versionadded:: 3.12
1826+
1827+
18121828
.. opcode:: HAVE_ARGUMENT
18131829

18141830
This is not really an opcode. It identifies the dividing line between

0 commit comments

Comments
 (0)