summaryrefslogtreecommitdiffstats
path: root/Lib/asyncio/futures.py
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-05-12 02:27:25 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-05-12 02:27:25 (GMT)
commit1af2bf75a2f816eaaf8353eaab8b6dcfee0064c0 (patch)
treed76885ce449761c6dd9893446f359a03327ed6d5 /Lib/asyncio/futures.py
parentd7e19bb566889343f39c34c98bca4d6db61b53d7 (diff)
downloadcpython-1af2bf75a2f816eaaf8353eaab8b6dcfee0064c0.zip
cpython-1af2bf75a2f816eaaf8353eaab8b6dcfee0064c0.tar.gz
cpython-1af2bf75a2f816eaaf8353eaab8b6dcfee0064c0.tar.bz2
asyncio: Support PEP 492. Issue #24017.
Diffstat (limited to 'Lib/asyncio/futures.py')
-rw-r--r--Lib/asyncio/futures.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py
index 74a99ba..d06828a 100644
--- a/Lib/asyncio/futures.py
+++ b/Lib/asyncio/futures.py
@@ -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."""