mirror of
https://github.com/python/cpython.git
synced 2025-10-14 02:43:49 +00:00
asyncio: Support PEP 492. Issue #24017.
This commit is contained in:
parent
d7e19bb566
commit
1af2bf75a2
6 changed files with 116 additions and 27 deletions
|
@ -19,6 +19,7 @@ _CANCELLED = 'CANCELLED'
|
|||
_FINISHED = 'FINISHED'
|
||||
|
||||
_PY34 = sys.version_info >= (3, 4)
|
||||
_PY35 = sys.version_info >= (3, 5)
|
||||
|
||||
Error = concurrent.futures._base.Error
|
||||
CancelledError = concurrent.futures.CancelledError
|
||||
|
@ -387,6 +388,9 @@ class Future:
|
|||
assert self.done(), "yield from wasn't used with future"
|
||||
return self.result() # May raise too.
|
||||
|
||||
if _PY35:
|
||||
__await__ = __iter__ # make compatible with 'await' expression
|
||||
|
||||
|
||||
def wrap_future(fut, *, loop=None):
|
||||
"""Wrap concurrent.futures.Future object."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue