agronholm / agronholm/anyio

`TaskGroup` doesn't raise cancelled when it should on asyncio

未關閉
#1,070 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
Python
星號
2.5k
分支
260
平均合併
1 天 8 小時
30 天內合併 PR
17

描述

### Things to check first

- [x] I have searched the existing issues and didn't find my bug already reported there

- [x] I have checked that my bug is still present in the latest release

### AnyIO version

main (a2a07c7c7af5d0f154b770f280d8772299a20a38)

### Python version

CPython 3.10.19, 3.11.14, 3.12.12, 3.13.11, 3.14.2

### What happened?

On asyncio, when

1. a task group is in a level-cancelled context

1. a spawned child of the task group exits raising a level-`CancelledError` due to the aforementioned level cancellation from above

1. after that child has exited, the body of the `async with tg:` block finishes running without raising any exception

then the task group incorrectly exits without raising a cancelled.

(FWIW, this is not a bug that I encountered IRL; I noticed it while reading the implementation while looking into #1069.)

### How can we reproduce the bug?

The `start_soon_and_wait-False` and `start_soon_and_wait_and_shielded_checkpoint-False` parameterizations of 1e3122a6c0ee9e0e55054c535c6158734f823108.

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。