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

fix: prevent undone task be killed by gc #48

Merged
merged 1 commit into from
Jun 11, 2022
Merged

fix: prevent undone task be killed by gc #48

merged 1 commit into from
Jun 11, 2022

Conversation

ProgramRipper
Copy link
Member

根据 python/cpython#91887 中描述的问题, asyncio 只会保留未完成的 Task 的弱引用.
所以, 不能使用 "free-flying tasks" 的形式.

本 pr 使用了 https://docs.python.org/zh-cn/3/library/asyncio-task.html#asyncio.create_task 中提供的解决方案

@ProgramRipper
Copy link
Member Author

我将会长期跟踪 python/cpython#91887 的后续处理结果.
如果未来的 asyncio 如该 issue 所建议的那样, 更改为保持对 Task 的强引用, 我将会移除此更改.

@BlueGlassBlock BlueGlassBlock self-requested a review June 11, 2022 09:30
@BlueGlassBlock BlueGlassBlock merged commit 2d24811 into GraiaProject:master Jun 11, 2022
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.

2 participants