mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
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:
parent
abae67ebc2
commit
8874342cf3
9 changed files with 79 additions and 82 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue