GH-85979: Clarify specification of object.__await__ (#22320)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
This commit is contained in:
Paolo Lammens 2022-12-31 07:24:04 +01:00 committed by GitHub
parent 4ebaae8aed
commit f59c7f8edd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.