Skip to content

Doc unclear that ensure_future should also have its referenced saved somewhere #129169

@ilan-schemoul

Description

@ilan-schemoul

Documentation

It will seem silly to some but the way the doc is written I was positive "Save a reference to the result of this function, to avoid a task disappearing mid-execution." applied to only create_task :

Image

As the note first reads about create_task I thought the "this" in "Save a reference to the result of this function" applied to create_tasks only.

We should reverse the order of the notes.

I'm sure some people would believe this to be a non issue but I have worked multiple times with ensure_future, and read this doc a few times, and me and even my senior coworkers (10 years in the company) seemed positive the note applied to create_tasks.
As tasks being destroyed, kinda randomly, by the GC can be a bug that can have profound consequences and can be really hard to debug I hope this matter will be taken seriously.
It's a struck of luck that I realized that the note applied to ensure_future and it took me hours of research to realize that it's likeley that the note also applies to ensure_future

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions