Skip to content
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: Carl Meyer <carl@oddbird.net>
  • Loading branch information
MatthieuDartiailh and carljm authored Sep 25, 2023
commit 364420046e6bc79585db918409f24fc98cf1d6c5
10 changes: 5 additions & 5 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ operations on it as if it was a Python list. The top of the stack corresponds to

Removes the top value from the stack.
Equivalent to ``POP_TOP``.
Used to clean up when a generator exit, hence the name.
Used to clean up when a generator exits.

.. versionadded:: 3.12

Expand Down Expand Up @@ -1151,20 +1151,20 @@ iterations of the loop.

.. opcode:: LOAD_SUPER_ATTR (namei)

This opcode implements :func:`super` both in its 0 argument form and in its
2 arguments form (e.g. ``super().method()``, ``super().attr`` and
This opcode implements :func:`super`, both in its zero-argument and
two-argument forms (e.g. ``super().method()``, ``super().attr`` and
``super(cls, self).method()``, ``super(cls, self).attr``).

It pops three values from the stack (from top of stack down):
- ``self``: the first argument to the current method
- ``cls``: the class within which the current method was defined)
- ``cls``: the class within which the current method was defined
- the global ``super``

With respect to its argument, it works similarly to :opcode:`LOAD_ATTR`,
except that ``namei`` is shifted left by 2 bits instead of 1.

The low bit of ``namei`` signals to attempt a method load, as with
:opcode:`LOAD_ATTR` which results in pushing ``None`` and the loaded method.
:opcode:`LOAD_ATTR`, which results in pushing ``None`` and the loaded method.
When it is unset a single value is pushed to the stack.

The second-low bit of ``namei``, if set, means that this was a two-argument
Expand Down