QUERY · ISSUE
extmod/uasyncio: gather gets stuck if you pass an empty list in v1.19
bugextmod
Hello, folks
This is pretty straightforward in v1.17 and v1.18 passing an empty list to gather will return (or yield) whereas in v1.19 it gets stuck for ever. Not sure if this is a new intended behavior (which is not in the docs?). I'm assuming this is a bug as there is nothing in the release notes.
Cheers,
CANDIDATE · ISSUE
extmod uasyncio: Cancelling a gather only cancels one task instead of all
bug
This is easy to explain, cancelling a gather(...) will only cancel one task, the remaining ones still continue.
Testcase:
async def test_gather_cancel_itself():
res = []
async def consumer():
nonlocal res
try:
await asyncio.sleep(1)
except asyncio.CancelledError:
dprint("wait() cancelled")
res.append(True)
else:
res.append(False)
async def gather():
t = []
for _ in range(5):
t.append(asyncio.create_task(consumer()))
try:
await asyncio.gather(*t)
except asyncio.CancelledError:
print("gather cancelled")
t = asyncio.create_task(gather())
await asyncio.sleep(0.1)
t.cancel()
await asyncio.sleep(1.5)
return res