Skip to content

Commit 9787a26

Browse files
authored
Document await-not-async error code (#15858)
1 parent 041a8af commit 9787a26

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

docs/source/error_code_list.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,9 +1027,20 @@ example:
10271027
10281028
top = await f() # Error: "await" outside function [top-level-await]
10291029
1030+
.. _code-await-not-async:
1031+
1032+
Warn about await expressions used outside of coroutines [await-not-async]
1033+
-------------------------------------------------------------------------
1034+
1035+
``await`` must be used inside a coroutine.
1036+
1037+
.. code-block:: python
1038+
1039+
async def f() -> None:
1040+
...
1041+
10301042
def g() -> None:
1031-
# This is a blocker error and cannot be silenced.
1032-
await f() # Error: "await" outside coroutine ("async def")
1043+
await f() # Error: "await" outside coroutine ("async def") [await-not-async]
10331044
10341045
.. _code-assert-type:
10351046

0 commit comments

Comments
 (0)