Add compatibility shim for asyncio.Future creation.

Should provide better support for uvloop.
This commit is contained in:
Rapptz
2017-01-25 21:38:50 -05:00
parent 62f43889c0
commit b876133e87
4 changed files with 13 additions and 4 deletions

View File

@@ -31,6 +31,15 @@ try:
except AttributeError:
create_task = asyncio.async
try:
_create_future = asyncio.AbstractEventLoop.create_future
except AttributeError:
def create_future(loop):
return asyncio.Future(loop=loop)
else:
def create_future(loop):
return loop.create_future()
try:
run_coroutine_threadsafe = asyncio.run_coroutine_threadsafe
except AttributeError: