Skip to content

Commit fa40aab

Browse files
miss-islingtonZeroIntensityvstinner
authored
[3.14] gh-141004: Document missing generator APIs (GH-141409) (GH-141789)
gh-141004: Document missing generator APIs (GH-141409) (cherry picked from commit 2da7ecc) Co-authored-by: Peter Bierma <zintensitydev@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org>
1 parent 59fa59e commit fa40aab

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

Doc/c-api/gen.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,41 @@ than explicitly calling :c:func:`PyGen_New` or :c:func:`PyGen_NewWithQualName`.
4444
with ``__name__`` and ``__qualname__`` set to *name* and *qualname*.
4545
A reference to *frame* is stolen by this function. The *frame* argument
4646
must not be ``NULL``.
47+
48+
.. c:function:: PyCodeObject* PyGen_GetCode(PyGenObject *gen)
49+
50+
Return a new :term:`strong reference` to the code object wrapped by *gen*.
51+
This function always succeeds.
52+
53+
54+
Asynchronous Generator Objects
55+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56+
57+
.. seealso::
58+
:pep:`525`
59+
60+
.. c:var:: PyTypeObject PyAsyncGen_Type
61+
62+
The type object corresponding to asynchronous generator objects. This is
63+
available as :class:`types.AsyncGeneratorType` in the Python layer.
64+
65+
.. versionadded:: 3.6
66+
67+
.. c:function:: PyObject *PyAsyncGen_New(PyFrameObject *frame, PyObject *name, PyObject *qualname)
68+
69+
Create a new asynchronous generator wrapping *frame*, with ``__name__`` and
70+
``__qualname__`` set to *name* and *qualname*. *frame* is stolen by this
71+
function and must not be ``NULL``.
72+
73+
On success, this function returns a :term:`strong reference` to the
74+
new asynchronous generator. On failure, this function returns ``NULL``
75+
with an exception set.
76+
77+
.. versionadded:: 3.6
78+
79+
.. c:function:: int PyAsyncGen_CheckExact(PyObject *op)
80+
81+
Return true if *op* is an asynchronous generator object, false otherwise.
82+
This function always succeeds.
83+
84+
.. versionadded:: 3.6

0 commit comments

Comments
 (0)