Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions Doc/c-api/descriptor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,45 @@ found in the dictionary of type objects.


.. c:function:: PyObject* PyWrapper_New(PyObject *, PyObject *)


Built-in descriptors
^^^^^^^^^^^^^^^^^^^^

.. c:var:: PyTypeObject PySuper_Type

The type object for super objects. This is the same object as
:class:`super` in the Python layer.


.. c:var:: PyTypeObject PyClassMethod_Type

The type of class method objects. This is the same object as
:class:`classmethod` in the Python layer.


.. c:function:: PyObject *PyClassMethod_New(PyObject *callable)

Create a new :class:`classmethod` object wrapping *callable*.
*callable* must be a callable object and must not be ``NULL``.

On success, this function returns a :term:`strong reference` to a new class
method descriptor. On failure, this function returns ``NULL`` with an
exception set.


.. c:var:: PyTypeObject PyStaticMethod_Type

The type of static method objects. This is the same object as
:class:`staticmethod` in the Python layer.


.. c:function:: PyObject *PyStaticMethod_New(PyObject *callable)

Create a new :class:`staticmethod` object wrapping *callable*.
*callable* must be a callable object and must not be ``NULL``.

On success, this function returns a :term:`strong reference` to a new static
method descriptor. On failure, this function returns ``NULL`` with an
exception set.

9 changes: 9 additions & 0 deletions Doc/c-api/function.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ There are a few functions specific to Python functions.
dictionary of arguments or ``NULL``.


.. c:function:: int PyFunction_SetKwDefaults(PyObject *op, PyObject *defaults)

Set the keyword-only argument default values of the function object *op*.
*defaults* must be a dictionary of keyword-only arguments or ``Py_None``.

This function returns ``0`` on success, and returns ``-1`` with an exception
set on failure.


.. c:function:: PyObject* PyFunction_GetClosure(PyObject *op)

Return the closure associated with the function object *op*. This can be ``NULL``
Expand Down
4 changes: 4 additions & 0 deletions Doc/library/dis.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1673,9 +1673,13 @@ iterations of the loop.
* ``0x02`` a dictionary of keyword-only parameters' default values
* ``0x04`` a tuple of strings containing parameters' annotations
* ``0x08`` a tuple containing cells for free variables, making a closure
* ``0x10`` the :term:`annotate function` for the function object

.. versionadded:: 3.13

.. versionchanged:: 3.14
Added ``0x10`` to indicate the annotate function for the function object.


.. opcode:: BUILD_SLICE (argc)

Expand Down
Loading