Issue #27095: Simplified MAKE_FUNCTION and removed MAKE_CLOSURE opcodes.

Patch by Demur Rumed.
This commit is contained in:
Serhiy Storchaka 2016-06-12 17:36:24 +03:00
parent 5697c4b641
commit 64204de04c
13 changed files with 4100 additions and 4160 deletions

View file

@ -937,27 +937,16 @@ All of the following opcodes use their arguments.
.. opcode:: MAKE_FUNCTION (argc)
Pushes a new function object on the stack. From bottom to top, the consumed
stack must consist of
stack must consist of values if the argument carries a specified flag value
* ``argc & 0xFF`` default argument objects in positional order
* ``(argc >> 8) & 0xFF`` pairs of name and default argument, with the name
just below the object on the stack, for keyword-only parameters
* ``(argc >> 16) & 0x7FFF`` parameter annotation objects
* a tuple listing the parameter names for the annotations (only if there are
ony annotation objects)
* ``0x01`` a tuple of default argument objects in positional order
* ``0x02`` a dictionary of keyword-only parameters' default values
* ``0x04`` an annotation dictionary
* ``0x08`` a tuple containing cells for free variables, making a closure
* the code associated with the function (at TOS1)
* the :term:`qualified name` of the function (at TOS)
.. opcode:: MAKE_CLOSURE (argc)
Creates a new function object, sets its *__closure__* slot, and pushes it on
the stack. TOS is the :term:`qualified name` of the function, TOS1 is the
code associated with the function, and TOS2 is the tuple containing cells for
the closure's free variables. *argc* is interpreted as in ``MAKE_FUNCTION``;
the annotations and defaults are also in the same order below TOS2.
.. opcode:: BUILD_SLICE (argc)
.. index:: builtin: slice