-
-
Notifications
You must be signed in to change notification settings - Fork 30k
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
Wait for cleanup coroutines before event loop is closed. #87004
Comments
To handle destruction of resources especially during exceptions, it would be nice if there were some way to provide coroutines/tasks that run at the termination or closure of an event loop. There are a lot of api options here. Maybe a simple one would be to have close() call a run_until_closed() function that starts all of these and steps the loop to wait for them, before closing, and provide run_close() functions to queue them for delay. |
asyncio.run() does the task |
I'm sorry, is this closure an error? Could you explain more how to use asyncio.run() to clean up resources when an unhandled exception is thrown? Is this new with a recent python improvement? |
asyncio.run() present since Python 3.7 Background tasks can use old good |
hey, I don't have the capacity to stay on this, but thanks for the attention, time, and clear response. there are of course other situations such as returning a resource to library code or manual loop management, but I don't have the use case present any more. maybe an aatexit library could patch this in if needed. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: