Skip to content

Use of await in a function that is not async should be shown as a syntax error by flake8 #818

Description

@kpinc

Hello,

Reporting here, since flake8 seems to want this sort of problem delegated to you.

The following code uses await in a function that is declared without the async keyword, which is a syntax error.

def foo():
    pass


def bar():
    await foo()

Running flake8 on this succeeds, no error is reported.

flake8 --version
7.1.1 (mccabe: 0.7.0, pycodestyle: 2.12.1, pyflakes: 3.2.0) CPython 3.11.2 on
Linux
Debian 12.7
pyflakes 3.2.0 installed in a virtual environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions