Skip to content

asyncio dev docs claim that asyncio debug mode checks for unawaited coroutines #133515

Closed
@graingert

Description

@graingert

Documentation

asyncio-dev docs claim:

asyncio checks for coroutines that were not awaited and logs them; this mitigates the “forgotten await” pitfall.

and the docs that points to claim:

When a coroutine function is called, but not awaited (e.g. coro() instead of await coro()) or the coroutine is not scheduled with asyncio.create_task(), asyncio will emit a RuntimeWarning:

this isn't true, python will produce warnings when coroutines are not awaited regardless of the dev mode of asyncio. The flag to set is -Werror and then replace sys.unraisablehook to detect these

I think this is a hold-over from when asyncio had generator based coroutines.

Linked PRs

Activity

added a commit that references this issue on May 16, 2025

gh-133515: fix docs for unawaited coroutines in debug mode (#134081)

d94b1e9
added a commit that references this issue on May 16, 2025

pythongh-133515: fix docs for unawaited coroutines in debug mode (pyt…

added 2 commits that reference this issue on May 16, 2025

[3.14] gh-133515: fix docs for unawaited coroutines in debug mode (GH…

2d00484

[3.13] gh-133515: fix docs for unawaited coroutines in debug mode (GH…

2a029a7

2 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      asyncio dev docs claim that asyncio debug mode checks for unawaited coroutines · Issue #133515 · python/cpython

      Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

      Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant