8000 GH-120507: Lower the `BEFORE_WITH` and `BEFORE_ASYNC_WITH` instructions. by markshannon · Pull Request #120640 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-120507: Lower the BEFORE_WITH and BEFORE_ASYNC_WITH instructions. #120640

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Jun 18, 2024
Prev Previous commit
Next Next commit
Update dis.rst
  • Loading branch information
markshannon committed Jun 17, 2024
commit ca765705f2669c24a5ce7e5b47ce17c521ec783a
33 changes: 11 additions & 22 deletions Doc/library/dis.rst
8000
Original file line number Diff line number Diff line change
Expand Up @@ -780,16 +780,6 @@ not have to be) the original ``STACK[-2]``.
.. versionadded:: 3.12


.. opcode:: BEFORE_ASYNC_WITH

Resolves ``__aenter__`` and ``__aexit__`` from ``STACK[-1]``.
Pushes ``__aexit__`` and result of ``__aenter__()`` to the stack::

STACK.extend((__aexit__, __aenter__())

.. versionadded:: 3.5



**Miscellaneous opcodes**

Expand Down Expand Up @@ -944,18 +934,6 @@ iterations of the loop.
Pushes :func:`!builtins.__build_class__` onto the stack. It is later called
to construct a class.


.. opcode:: BEFORE_WITH

This opcode performs several operations before a with block starts. First,
it loads :meth:`~object.__exit__` from the context manager and pushes it onto
the stack for later use by :opcode:`WITH_EXCEPT_START`. Then,
:meth:`~object.__enter__` is called. Finally, the result of calling the
``__enter__()`` method is pushed onto the stack.

.. versionadded:: 3.11


.. opcode:: GET_LEN

Perform ``STACK.append(len(STACK[-1]))``.
Expand Down Expand Up @@ -1812,6 +1790,17 @@ iterations of the loop.
.. versionadded:: 3.12


.. opcode:: LOAD_SPECIAL

Performs special method lookup on ``STACK[-1]``.
If ``type(STACK[-1]).__xxx__`` is a method, leave
``type(STACK[-1]).__xxx__; STACK[-1]`` on the stack.
If ``type(STACK[-1]).__xxx__`` is not a method, leave
``STACK[-1].__xxx__; NULL`` on the stack.

.. versionadded:: 3.14


**Pseudo-instructions**

These opcodes do not appear in Python bytecode. They are used by the compiler
Expand Down
Loading
0