MOTOR-979 Use asyncio.get_event_loop so that DeprecationWarnings are correctly issued (#170)
This commit is contained in:
parent
a6b2a79e0c
commit
a77db8f0bc
@ -24,7 +24,7 @@ import functools
|
||||
import multiprocessing
|
||||
import os
|
||||
import warnings
|
||||
from asyncio import coroutine # noqa: F401 - For framework interface.
|
||||
from asyncio import coroutine, get_event_loop # noqa: F401 - For framework interface.
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
try:
|
||||
@ -36,14 +36,6 @@ except ImportError:
|
||||
CLASS_PREFIX = "AsyncIO"
|
||||
|
||||
|
||||
def get_event_loop():
|
||||
try:
|
||||
return asyncio.get_running_loop()
|
||||
except RuntimeError:
|
||||
# Workaround for bugs.python.org/issue39529.
|
||||
return asyncio.get_event_loop_policy().get_event_loop()
|
||||
|
||||
|
||||
def is_event_loop(loop):
|
||||
return isinstance(loop, asyncio.AbstractEventLoop)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user