Skip to content

trio-sync-call (ASYNC105)

Derived from the flake8-async linter.

Fix is sometimes available.

What it does

Checks for calls to trio functions that are not immediately awaited.

Why is this bad?

Many of the functions exposed by trio are asynchronous, and must be awaited to take effect. Calling a trio function without an await can lead to RuntimeWarning diagnostics and unexpected behaviour.

Example

async def double_sleep(x):
    trio.sleep(2 * x)

Use instead:

async def double_sleep(x):
    await trio.sleep(2 * x)

Fix safety

This rule's fix is marked as unsafe, as adding an await to a function call changes its semantics and runtime behavior.