aboutsummaryrefslogtreecommitdiff
path: root/discord/compat.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2017-01-25 21:38:50 -0500
committerRapptz <[email protected]>2017-01-25 21:38:50 -0500
commitb876133e87b29a6959eb766d006fa6b57db1037e (patch)
tree420643e1d71aaefc460f36ffe421c1a8108d54a3 /discord/compat.py
parentRemove unused ChannelPermissions namedtuple. (diff)
downloaddiscord.py-b876133e87b29a6959eb766d006fa6b57db1037e.tar.xz
discord.py-b876133e87b29a6959eb766d006fa6b57db1037e.zip
Add compatibility shim for asyncio.Future creation.
Should provide better support for uvloop.
Diffstat (limited to 'discord/compat.py')
-rw-r--r--discord/compat.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/discord/compat.py b/discord/compat.py
index 43294254..3b9e66ff 100644
--- a/discord/compat.py
+++ b/discord/compat.py
@@ -32,6 +32,15 @@ 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:
# the following code is slightly modified from the