You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Important : Save a reference to the result of this function, to avoid a task disappearing mid execution."
The issue is that if the assignment task= isn't made, then (it seems) Python 3.9+ will automatically clean up the unused reference - ending the async task (which will complain about being terminated, etc), i.e. the following will ~fail :
async def coro():
...
# In Python 3.9+
asyncio.create_task(coro())
If someone is listening : I'd be happy to do a PR to fix this issue in the examples and README. It was really quite puzzling to debug since the apparent error and what creates it (Python internals being changed, and a small note in the docs) are pretty distinct.
The text was updated successfully, but these errors were encountered:
mdda
changed the title
Save a reference each task created...
Save a reference to each task created...
Feb 21, 2022
A comment appeared in the Python 3.9+ asyncio documentation :
"Important : Save a reference to the result of this function, to avoid a task disappearing mid execution."
The issue is that if the assignment
task=
isn't made, then (it seems) Python 3.9+ will automatically clean up the unused reference - ending the async task (which will complain about being terminated, etc), i.e. the following will ~fail :If someone is listening : I'd be happy to do a PR to fix this issue in the examples and README. It was really quite puzzling to debug since the apparent error and what creates it (Python internals being changed, and a small note in the docs) are pretty distinct.
The text was updated successfully, but these errors were encountered: