Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

GH-93429: Document LOAD_METHOD removal#93803

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from1 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
NextNext commit
Documentation for removing LOAD_METHOD
  • Loading branch information
@Fidget-Spinner
Fidget-Spinner committedJun 14, 2022
commit7a8c3d6ec14d203db0c0a68f291e0563071b7a40
27 changes: 14 additions & 13 deletionsDoc/library/dis.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -887,7 +887,20 @@ iterations of the loop.

.. opcode:: LOAD_ATTR (namei)

Replaces TOS with ``getattr(TOS, co_names[namei])``.
If the low bit of ``namei`` is not set, this replaces TOS with
``getattr(TOS, co_names[namei>>1])``.

If the low bit of ``namei`` is set, this will attempt to load a method named
``co_names[namei>>i]`` from the TOS object. TOS is popped.
This bytecode distinguishes two cases: if TOS has a method with the correct
name, the bytecode pushes the unbound method and TOS. TOS will be used as
the first argument (``self``) by :opcode:`CALL` when calling the
unbound method. Otherwise, ``NULL`` and the object return by the attribute
lookup are pushed.

.. versionchanged:: 3.11
If the low bit of ``namei`` is set, then a ``NULL`` or ``self`` is
pushed to the stack before the attribute or unbound method respectively.


.. opcode:: COMPARE_OP (opname)
Expand DownExpand Up@@ -1189,18 +1202,6 @@ iterations of the loop.
.. versionadded:: 3.6


.. opcode:: LOAD_METHOD (namei)

Loads a method named ``co_names[namei]`` from the TOS object. TOS is popped.
This bytecode distinguishes two cases: if TOS has a method with the correct
name, the bytecode pushes the unbound method and TOS. TOS will be used as
the first argument (``self``) by :opcode:`CALL` when calling the
unbound method. Otherwise, ``NULL`` and the object return by the attribute
lookup are pushed.

.. versionadded:: 3.7


.. opcode:: PUSH_NULL

Pushes a ``NULL`` to the stack.
Expand Down
9 changes: 9 additions & 0 deletionsDoc/whatsnew/3.12.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -106,6 +106,15 @@ Optimizations
(Contributed by Inada Naoki in :gh:`92536`.)


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

* Removed the :opcode:`LOAD_METHOD` instruction. It has been merged into
:opcode:`LOAD_ATTR`. :opcode:`LOAD_ATTR` will now behave like the old
:opcode:`LOAD_METHOD` instruction if the low bit of its oparg is set.
(Contributed by Ken Jin in :gh:`93429`.)


Deprecated
==========

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp