agronholm / agronholm/anyio

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

Aperta
#1,070 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Python
Stelle
2.5k
Fork
260
Merge medio
2g 8h
PR unite (30g)
19

Descrizione

### 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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.