From 03bb0895fe397b638a0432fbcae6bd55c843d6e3 Mon Sep 17 00:00:00 2001 From: hauntsaninja Date: Sat, 12 Aug 2023 13:59:41 -0700 Subject: [PATCH] Document await-not-async error code --- docs/source/error_code_list.rst | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/source/error_code_list.rst b/docs/source/error_code_list.rst index f7f702aa7fcb..157f90249af8 100644 --- a/docs/source/error_code_list.rst +++ b/docs/source/error_code_list.rst @@ -1027,9 +1027,20 @@ example: top = await f() # Error: "await" outside function [top-level-await] +.. _code-await-not-async: + +Warn about await expressions used outside of coroutines [await-not-async] +------------------------------------------------------------------------- + +``await`` must be used inside a coroutine. + +.. code-block:: python + + async def f() -> None: + ... + def g() -> None: - # This is a blocker error and cannot be silenced. - await f() # Error: "await" outside coroutine ("async def") + await f() # Error: "await" outside coroutine ("async def") [await-not-async] .. _code-assert-type: