Skip to content

asyncio Event Loop does not provide warning about keeping a reference to returned task #155502

Description

@camblomquist

Documentation

The high level asyncio documentation warns that one should save the result of asyncio.create_task as the event loop only keeps weak references to tasks.
This same warning is not seen in the low level Event Loop documentation even though the same rules apply. The example code snippets also do not save a reference which would lead readers to believe it is safe to discard the result of the EventLoop.create_task function when it is not.

Relevant function in the high level documentation: https://docs.python.org/3/library/asyncio-task.html#asyncio.create_task

Relevant function in the low level documentation: https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.loop.create_task

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions