bpo-32258: Replace 'yield from' to 'await' in asyncio docs (#4779)

* Replace 'yield from' to 'await' in asyncio docs

* Fix docstrings
This commit is contained in:
Andrew Svetlov 2017-12-11 17:35:49 +02:00 committed by GitHub
parent abae67ebc2
commit 8874342cf3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 79 additions and 82 deletions

View file

@ -59,7 +59,8 @@ class Future:
# The value must also be not-None, to enable a subclass to declare
# that it is not compatible by setting this to None.
# - It is set by __iter__() below so that Task._step() can tell
# the difference between `yield from Future()` (correct) vs.
# the difference between
# `await Future()` or`yield from Future()` (correct) vs.
# `yield Future()` (incorrect).
_asyncio_future_blocking = False
@ -236,7 +237,7 @@ class Future:
if not self.done():
self._asyncio_future_blocking = True
yield self # This tells Task to wait for completion.
assert self.done(), "yield from wasn't used with future"
assert self.done(), "await wasn't used with future"
return self.result() # May raise too.
__await__ = __iter__ # make compatible with 'await' expression