Merge pull request #1985 from anonymousx97/patch-1

Update base_provider: Do not nest patch uvloop loop.
pull/1995/head
H Lohaus 2 weeks ago committed by GitHub
commit f956288780
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -30,6 +30,13 @@ if sys.platform == 'win32':
def get_running_loop(check_nested: bool) -> Union[AbstractEventLoop, None]:
try:
loop = asyncio.get_running_loop()
# Do not patch uvloop loop because its incompatible.
try:
import uvloop
if isinstance(loop, uvloop.Loop):
return loop
except (ImportError, ModuleNotFoundError):
pass
if check_nested and not hasattr(loop.__class__, "_nest_patched"):
try:
import nest_asyncio
@ -290,4 +297,4 @@ class ProviderModelMixin:
elif model not in cls.get_models() and cls.models:
raise ModelNotSupportedError(f"Model is not supported: {model} in: {cls.__name__}")
debug.last_model = model
return model
return model

Loading…
Cancel
Save