Skip to content

TaskGroup propagates CancelledError rather than a MultiError on exception #34

@bdowning

Description

@bdowning

See the following snippet:

import asyncio
import aiotools

async def error():
    await asyncio.sleep(1)
    raise Exception("bad stuff")

async def main():
    try:
        async with aiotools.TaskGroup() as tg:
            tg.create_task(error())
            await asyncio.sleep(5)
    except Exception as e:
        print(f"Got inner {repr(e)}")
        raise

try:
    asyncio.run(main())
except BaseException as e:
    print(f"Got outer {repr(e)}")
Got outer CancelledError()

Is this expected behavior? It feels wrong, since a) it ate an exception and b) the task wasn't actually cancelled.

This is Python 3.9 and aiotools 1.4.0.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions