Skip to content
Merged
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
15 changes: 8 additions & 7 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1171,20 +1171,21 @@ iterations of the loop.

.. opcode:: BUILD_INTERPOLATION

Constructs an Interpolation object from the following components, and pushes
it onto the stack:
It expects as stack inputs (from top of stack down):

* ``value``: the evaluated result at runtime
* ``name``: the expression's source code as a string
* ``format``: the format specification
* ``format``: ``STACK[oparg & 1]``
* ``str``: ``STACK[-1 - (oparg & 1)]``
* ``value``: ``STACK[-2 - (oparg & 1)]``

It outputs the interpolation object to ``STACK[-1]`` after consuming its inputs.

.. versionadded:: 3.14


.. opcode:: BUILD_TEMPLATE

Create a Template object consuming interpolations and a string from the stack,
and pushes it onto the stack.
It consumes ``STACK[-1]``(string) and ``STACK[-2]``(interpolations) and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this is pretty close. One small error: it's the other way around, interpolations is STACK[-1], string is STACK[-2]. This is because the bytecode definition file models a stack (LIFO), which means the rightmost element is the top of the stack.

outputs the template object to ``STACK[-1]``.

.. versionadded:: 3.14

Expand Down
Loading