Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
5e99b56d
Commit
5e99b56d
authored
Sep 17, 2018
by
Serhiy Storchaka
Committed by
GitHub
Sep 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-33216: Improve the documentation for CALL_FUNCTION_* (GH-8338) (GH-8784)
parent
b3a271fc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
26 deletions
+34
-26
Doc/library/dis.rst
Doc/library/dis.rst
+34
-26
No files found.
Doc/library/dis.rst
View file @
5e99b56d
...
@@ -1104,18 +1104,20 @@ All of the following opcodes use their arguments.
...
@@ -1104,18 +1104,20 @@ All of the following opcodes use their arguments.
.. opcode:: RAISE_VARARGS (argc)
.. opcode:: RAISE_VARARGS (argc)
Raises an exception. *argc* indicates the number of
parameter
s to the raise
Raises an exception. *argc* indicates the number of
argument
s to the raise
statement, ranging from 0 to 3. The handler will find the traceback as TOS2,
statement, ranging from 0 to 3. The handler will find the traceback as TOS2,
the parameter as TOS1, and the exception as TOS.
the parameter as TOS1, and the exception as TOS.
.. opcode:: CALL_FUNCTION (argc)
.. opcode:: CALL_FUNCTION (argc)
Calls a function. *argc* indicates the number of positional arguments.
Calls a callable object with positional arguments.
The positional arguments are on the stack, with the right-most argument
*argc* indicates the number of positional arguments.
on top. Below the arguments, the function object to call is on the stack.
The top of the stack contains positional arguments, with the right-most
Pops all function arguments, and the function itself off the stack, and
argument on top. Below the arguments is a callable object to call.
pushes the return value.
``CALL_FUNCTION`` pops all arguments and the callable object off the stack,
calls the callable object with those arguments, and pushes the return value
returned by the callable object.
.. versionchanged:: 3.6
.. versionchanged:: 3.6
This opcode is used only for calls with positional arguments.
This opcode is used only for calls with positional arguments.
...
@@ -1123,31 +1125,36 @@ All of the following opcodes use their arguments.
...
@@ -1123,31 +1125,36 @@ All of the following opcodes use their arguments.
.. opcode:: CALL_FUNCTION_KW (argc)
.. opcode:: CALL_FUNCTION_KW (argc)
Calls a function. *argc* indicates the number of arguments (positional
Calls a callable object with positional (if any) and keyword arguments.
and keyword). The top element on the stack contains a tuple of keyword
*argc* indicates the total number of positional and keyword arguments.
argument names. Below the tuple, keyword arguments are on the stack, in
The top element on the stack contains a tuple of keyword argument names.
the order corresponding to the tuple. Below the keyword arguments, the
Below that are keyword arguments in the order corresponding to the tuple.
positional arguments are on the stack, with the right-most parameter on
Below that are positional arguments, with the right-most parameter on
top. Below the arguments, the function object to call is on the stack.
top. Below the arguments is a callable object to call.
Pops all function arguments, and the function itself off the stack, and
``CALL_FUNCTION_KW`` pops all arguments and the callable object off the stack,
pushes the return value.
calls the callable object with those arguments, and pushes the return value
returned by the callable object.
.. versionchanged:: 3.6
.. versionchanged:: 3.6
Keyword arguments are packed in a tuple instead of a dictionary,
Keyword arguments are packed in a tuple instead of a dictionary,
*argc* indicates the total number of arguments
*argc* indicates the total number of arguments
.
.. opcode:: CALL_FUNCTION_EX (flags)
.. opcode:: CALL_FUNCTION_EX (flags)
Calls a function. The lowest bit of *flags* indicates whether the
Calls a callable object with variable set of positional and keyword
var-keyword argument is placed at the top of the stack. Below the
arguments. If the lowest bit of *flags* is set, the top of the stack
var-keyword argument, the var-positional argument is on the stack.
contains a mapping object containing additional keyword arguments.
Below the arguments, the function object to call is placed.
Below that is an iterable object containing positional arguments and
Pops all function arguments, and the function itself off the stack, and
a callable object to call. :opcode:`BUILD_MAP_UNPACK_WITH_CALL` and
pushes the return value. Note that this opcode pops at most three items
:opcode:`BUILD_TUPLE_UNPACK_WITH_CALL` can be used for merging multiple
from the stack. Var-positional and var-keyword arguments are packed
mapping objects and iterables containing arguments.
by :opcode:`BUILD_TUPLE_UNPACK_WITH_CALL` and
Before the callable is called, the mapping object and iterable object
:opcode:`BUILD_MAP_UNPACK_WITH_CALL`.
are each "unpacked" and their contents passed in as keyword and
positional arguments respectively.
``CALL_FUNCTION_EX`` pops all arguments and the callable object off the stack,
calls the callable object with those arguments, and pushes the return value
returned by the callable object.
.. versionadded:: 3.6
.. versionadded:: 3.6
...
@@ -1179,7 +1186,8 @@ All of the following opcodes use their arguments.
...
@@ -1179,7 +1186,8 @@ All of the following opcodes use their arguments.
Pushes a new function object on the stack. From bottom to top, the consumed
Pushes a new function object on the stack. From bottom to top, the consumed
stack must consist of values if the argument carries a specified flag value
stack must consist of values if the argument carries a specified flag value
* ``0x01`` a tuple of default argument objects in positional order
* ``0x01`` a tuple of default values for positional-only and
positional-or-keyword parameters in positional order
* ``0x02`` a dictionary of keyword-only parameters' default values
* ``0x02`` a dictionary of keyword-only parameters' default values
* ``0x04`` an annotation dictionary
* ``0x04`` an annotation dictionary
* ``0x08`` a tuple containing cells for free variables, making a closure
* ``0x08`` a tuple containing cells for free variables, making a closure
...
@@ -1262,7 +1270,7 @@ instructions:
...
@@ -1262,7 +1270,7 @@ instructions:
.. data:: hasconst
.. data:: hasconst
Sequence of bytecodes that
have a constant parameter
.
Sequence of bytecodes that
access a constant
.
.. data:: hasfree
.. data:: hasfree
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment