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

Consider using asyncio.run implementation in AsyncToSync #28

Closed
andriilahuta opened this issue Feb 17, 2018 · 1 comment
Closed

Consider using asyncio.run implementation in AsyncToSync #28

andriilahuta opened this issue Feb 17, 2018 · 1 comment

Comments

@andriilahuta
Copy link
Contributor

Python 3.7 introduces new asyncio.run function. Would be nice to backport its implementation for standalone loop in AsyncToSync. It adds an extra level of reliability by wrapping loop.run_until_complete with try/finally, cancelling pending tasks and closing async generators.
On a side note, it seems that loop.create_task should be preferred to asyncio.ensure_future in most cases, according to Guido.

@andrewgodwin
Copy link
Member

When Python 3.7 is released I'll come back and consider it, but we're still months away and we'd have to keep the existing implementation anyway to support 3.5. I will, however, go and crib from the implementation to make sure AsyncToSync is doing all the right cleanup.

As for create_task, I've moved to that here: c7e0065

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

No branches or pull requests

2 participants