Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(28888)

Side by Side Diff: Doc/library/dis.rst

Issue 27095: Simplify MAKE_FUNCTION
Patch Set: Created 3 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Include/opcode.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 :mod:`dis` --- Disassembler for Python bytecode 1 :mod:`dis` --- Disassembler for Python bytecode
2 =============================================== 2 ===============================================
3 3
4 .. module:: dis 4 .. module:: dis
5 :synopsis: Disassembler for Python bytecode. 5 :synopsis: Disassembler for Python bytecode.
6 6
7 **Source code:** :source:`Lib/dis.py` 7 **Source code:** :source:`Lib/dis.py`
8 8
9 -------------- 9 --------------
10 10
(...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 value is on top of the key. Below the keyword parameters, the positional 922 value is on top of the key. Below the keyword parameters, the positional
923 parameters are on the stack, with the right-most parameter on top. Below the 923 parameters are on the stack, with the right-most parameter on top. Below the
924 parameters, the function object to call is on the stack. Pops all function 924 parameters, the function object to call is on the stack. Pops all function
925 arguments, and the function itself off the stack, and pushes the return 925 arguments, and the function itself off the stack, and pushes the return
926 value. 926 value.
927 927
928 928
929 .. opcode:: MAKE_FUNCTION (argc) 929 .. opcode:: MAKE_FUNCTION (argc)
930 930
931 Pushes a new function object on the stack. From bottom to top, the consumed 931 Pushes a new function object on the stack. From bottom to top, the consumed
932 stack must consist of 932 stack must consist of values if the argument carries a specified flag value
933 933
934 * ``argc & 0xFF`` default argument objects in positional order 934 * ``0x01`` a tuple of default argument objects in positional order
935 * ``(argc >> 8) & 0xFF`` pairs of name and default argument, with the name 935 * ``0x02`` a dictionary of keyword-only parameters' default values
936 just below the object on the stack, for keyword-only parameters 936 * ``0x04`` an annotation dictionary
937 * ``(argc >> 16) & 0x7FFF`` parameter annotation objects 937 * ``0x08`` a tuple containing cells for free variables, making a closure
938 * a tuple listing the parameter names for the annotations (only if there are
939 ony annotation objects)
940 * the code associated with the function (at TOS1) 938 * the code associated with the function (at TOS1)
941 * the :term:`qualified name` of the function (at TOS) 939 * the :term:`qualified name` of the function (at TOS)
942
943
944 .. opcode:: MAKE_CLOSURE (argc)
945
946 Creates a new function object, sets its *__closure__* slot, and pushes it on
947 the stack. TOS is the :term:`qualified name` of the function, TOS1 is the
948 code associated with the function, and TOS2 is the tuple containing cells for
949 the closure's free variables. *argc* is interpreted as in ``MAKE_FUNCTION``;
950 the annotations and defaults are also in the same order below TOS2.
951 940
952 941
953 .. opcode:: BUILD_SLICE (argc) 942 .. opcode:: BUILD_SLICE (argc)
954 943
955 .. index:: builtin: slice 944 .. index:: builtin: slice
956 945
957 Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2, 946 Pushes a slice object on the stack. *argc* must be 2 or 3. If it is 2,
958 ``slice(TOS1, TOS)`` is pushed; if it is 3, ``slice(TOS2, TOS1, TOS)`` is 947 ``slice(TOS1, TOS)`` is pushed; if it is 3, ``slice(TOS2, TOS1, TOS)`` is
959 pushed. See the :func:`slice` built-in function for more information. 948 pushed. See the :func:`slice` built-in function for more information.
960 949
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 1058
1070 1059
1071 .. data:: haslocal 1060 .. data:: haslocal
1072 1061
1073 Sequence of bytecodes that access a local variable. 1062 Sequence of bytecodes that access a local variable.
1074 1063
1075 1064
1076 .. data:: hascompare 1065 .. data:: hascompare
1077 1066
1078 Sequence of bytecodes of Boolean operations. 1067 Sequence of bytecodes of Boolean operations.
OLDNEW
« no previous file with comments | « no previous file | Include/opcode.h » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+