Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use asyncio.run instead of get_event_loop() #155

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hrnciar
Copy link

@hrnciar hrnciar commented Feb 22, 2023

Fixes: #154

Comment on lines +32 to +40
try:
from asyncio import run
aio_run = run
except ImportError:
# Python 3.5
from asyncio import get_event_loop
return get_event_loop().run_until_complete(awaitable)
else:
return aio_run(awaitable)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the aio_run = run was meant to define the runner on both try / except branches, right?
If you're not going to do it anymore, there's no need for the aio_run alias, let's drop it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compatibility with Python 3.12 - RuntimeError: There is no current event loop in thread 'MainThread'.
3 participants