This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author JustAnotherArchivist
Recipients JustAnotherArchivist, asvetlov, yselivanov
Date 2020-07-11.02:41:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
While the situation is clear regarding coroutine objects (#25887), as far as I can see, the documentation doesn't specify whether asyncio.Futures can be awaited multiple times. The code has always (at least since the integration into CPython) allowed for it since Future.__await__ simply returns Future.result() if it is already done. Is this guaranteed/intended behaviour, as also implied by some of the comments on #25887, or is it considered an implementation detail?

Here are the only two things I found in the documentation regarding this:

> library/asyncio-task: When a Future object is awaited it means that the coroutine will wait until the Future is resolved in some other place.

> library/asyncio-future: Future is an awaitable object. Coroutines can await on Future objects until they either have a result or an exception set, or until they are cancelled.

Neither of these say anything about awaiting a Future that is already resolved, i.e. has a result, has an exception, or was cancelled.

If this is intended to be guaranteed, it should be mentioned in the Future documentation. If it is considered an implementation detail, it's probably not necessary to explicitly mention this anywhere, but it might be a good idea to add another line to e.g. the asyncio.wait example on how to correctly retrieve the result of an already-awaited Future/Task.
Date User Action Args
2020-07-11 02:41:58JustAnotherArchivistsetrecipients: + JustAnotherArchivist, asvetlov, yselivanov
2020-07-11 02:41:58JustAnotherArchivistsetmessageid: <>
2020-07-11 02:41:58JustAnotherArchivistlinkissue41275 messages
2020-07-11 02:41:58JustAnotherArchivistcreate