diff options
author | INADA Naoki <songofacandy@gmail.com> | 2017-01-16 08:23:30 (GMT) |
---|---|---|
committer | INADA Naoki <songofacandy@gmail.com> | 2017-01-16 08:23:30 (GMT) |
commit | 015bce64b35fb9de199f41eb5a3e5b7d9d20e3c1 (patch) | |
tree | 374e77e17b8325e6db020a4ed21ceeae1bb6de71 /Doc | |
parent | 510df6f2721bd6ed69716938c45cea03b2b84c99 (diff) | |
download | cpython-015bce64b35fb9de199f41eb5a3e5b7d9d20e3c1.zip cpython-015bce64b35fb9de199f41eb5a3e5b7d9d20e3c1.tar.gz cpython-015bce64b35fb9de199f41eb5a3e5b7d9d20e3c1.tar.bz2 |
Issue #26110: Add document for LOAD_METHOD and CALL_METHOD opcode.
Changed stack layout bit for "easy to explain."
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/dis.rst | 22 | ||||
-rw-r--r-- | Doc/whatsnew/3.7.rst | 7 |
2 files changed, 29 insertions, 0 deletions
diff --git a/Doc/library/dis.rst b/Doc/library/dis.rst index a15690b..694d564 100644 --- a/Doc/library/dis.rst +++ b/Doc/library/dis.rst @@ -957,6 +957,28 @@ All of the following opcodes use their arguments. value. +.. opcode:: LOAD_METHOD (namei) + + Loads a method named ``co_names[namei]`` from TOS object. TOS is popped and + method and TOS are pushed when interpreter can call unbound method directly. + TOS will be uesd as the first argument (``self``) by :opcode:`CALL_METHOD`. + Otherwise, ``NULL`` and method is pushed (method is bound method or + something else). + + .. versionadded:: 3.7 + + +.. opcode:: CALL_METHOD (argc) + + Calls a method. *argc* is number of positional arguments. + Keyword arguments are not supported. This opcode is designed to be used + with :opcode:`LOAD_METHOD`. Positional arguments are on top of the stack. + Below them, two items described in :opcode:`LOAD_METHOD` on the stack. + All of them are popped and return value is pushed. + + .. versionadded:: 3.7 + + .. opcode:: MAKE_FUNCTION (argc) Pushes a new function object on the stack. From bottom to top, the consumed diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst index ca7c2c5..fe03def 100644 --- a/Doc/whatsnew/3.7.rst +++ b/Doc/whatsnew/3.7.rst @@ -170,3 +170,10 @@ Changes in the Python API Assigning to them was deprecated in Python 3.5. Use the :meth:`~http.cookies.Morsel.set` method for setting them. (Contributed by Serhiy Storchaka in :issue:`29192`.) + + +CPython bytecode changes +------------------------ + +* Added two new opcodes: :opcode:`LOAD_METHOD`` and :opcode:`CALL_METHOD`. + (Contributed by Yury Selivanov and INADA Naoki in :issue:`26110`.) |