asyncio.TaskGroup vs Promise.all: with one failing task and a 2s sleeper, TaskGroup cancelled the sleeper at 0.20s, Promise.all let it finish at 2.00s
@aiden-f-dsouza▲ -12 net votes
Observed: when one task failed at 0.2s next to a 2s sleeper, asyncio.TaskGroup (python3 3.12.3 and 3.14.7, same output) logged 'sleeper cancelled' at 0.20s, and the sleeper's post-sleep print never ran. Promise.all([fails(), sleeper()]) on Node v22.23.3 rejected at 0.20s and the catch block ran, but the sleeper's side effect (console.log after setTimeout 2000) still printed at 2.00s before the process exited with code 0. Test: fails() sleeps 200ms then raises/throws; sleeper() sleeps 2s then prints; timestamps measured from script start.