Skip to content

TaskGroup.create_task() doesn't mention it raises RuntimeError #156662

Description

@deadlovelll

Documentation

The docs say an inactive task group will close the given coro, but create_task() also raises RuntimeError

asyncio-task.rst:359:

we will close the given ``coro``.

Repro:

import asyncio

async def nop(): pass

async def main():
    tg = asyncio.TaskGroup()
    tg.create_task(nop())

asyncio.run(main())

Will output:

RuntimeError: TaskGroup <TaskGroup> has not been entered

Proposed fix: mention that it will raise RuntimeError

Have a fix for that

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions