python
runtime_error
ai_generated
true
ExceptionGroup: TaskGroup 中未处理的错误
ExceptionGroup: unhandled errors in a TaskGroup
ID: python/asyncio-task-group-exception
80%修复率
84%置信度
0证据数
2024-07-22首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 3.11 | active | — | — | — |
根因分析
asyncio.TaskGroup 中多个异常被聚合为 ExceptionGroup,需要特殊处理。
English
Multiple exceptions raised in asyncio.TaskGroup are aggregated into ExceptionGroup, requiring special handling.
解决方案
-
90% 成功率
except* Exception: # handle all exceptions in group
-
85% 成功率
for ex in eg.exceptions: # iterate and handle individually
无效尝试
常见但无效的做法:
- 80% 失败
- 50% 失败