From: Paolo Lammens Date: Sat, 31 Dec 2022 06:24:04 +0000 (+0100) Subject: GH-85979: Clarify specification of `object.__await__` (#22320) X-Git-Tag: v3.12.0a4~90 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f59c7f8edd5ba5f6c1954383542a2292bcf51d91;p=thirdparty%2FPython%2Fcpython.git GH-85979: Clarify specification of `object.__await__` (#22320) Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com> --- diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index fd682fcff020..1d2ddf3507ae 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -2950,6 +2950,14 @@ are awaitable. :term:`awaitable` objects. For instance, :class:`asyncio.Future` implements this method to be compatible with the :keyword:`await` expression. + .. note:: + + The language doesn't place any restriction on the type or value of the + objects yielded by the iterator returned by ``__await__``, as this is + specific to the implementation of the asynchronous execution framework + (e.g. :mod:`asyncio`) that will be managing the :term:`awaitable` object. + + .. versionadded:: 3.5 .. seealso:: :pep:`492` for additional information about awaitable objects.