Skip to content

Commit b356a47

Browse files
authored
gh-105678: document SET_FUNCTION_ATTRIBUTE (#105843)
1 parent 957a974 commit b356a47

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

Doc/library/dis.rst

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,23 +1421,34 @@ iterations of the loop.
14211421
.. versionadded:: 3.11
14221422

14231423

1424-
.. opcode:: MAKE_FUNCTION (flags)
1424+
.. opcode:: MAKE_FUNCTION
14251425

1426-
Pushes a new function object on the stack. From bottom to top, the consumed
1427-
stack must consist of values if the argument carries a specified flag value
1426+
Pushes a new function object on the stack built from the code object at ``STACK[1]``.
1427+
1428+
.. versionchanged:: 3.10
1429+
Flag value ``0x04`` is a tuple of strings instead of dictionary
1430+
1431+
.. versionchanged:: 3.11
1432+
Qualified name at ``STACK[-1]`` was removed.
1433+
1434+
.. versionchanged:: 3.13
1435+
Extra function attributes on the stack, signaled by oparg flags, were
1436+
removed. They now use :opcode:`SET_FUNCTION_ATTRIBUTE`.
1437+
1438+
1439+
.. opcode:: SET_FUNCTION_ATTRIBUTE (flag)
1440+
1441+
Sets an attribute on a function object. Expects the function at ``STACK[-1]``
1442+
and the attribute value to set at ``STACK[-2]``; consumes both and leaves the
1443+
function at ``STACK[-1]``. The flag determines which attribute to set:
14281444

14291445
* ``0x01`` a tuple of default values for positional-only and
14301446
positional-or-keyword parameters in positional order
14311447
* ``0x02`` a dictionary of keyword-only parameters' default values
14321448
* ``0x04`` a tuple of strings containing parameters' annotations
14331449
* ``0x08`` a tuple containing cells for free variables, making a closure
1434-
* the code associated with the function (at ``STACK[-1]``)
1435-
1436-
.. versionchanged:: 3.10
1437-
Flag value ``0x04`` is a tuple of strings instead of dictionary
14381450

1439-
.. versionchanged:: 3.11
1440-
Qualified name at ``STACK[-1]`` was removed.
1451+
.. versionadded:: 3.13
14411452

14421453

14431454
.. opcode:: BUILD_SLICE (argc)

0 commit comments

Comments
 (0)