Use of await in a function that is not async should be shown as a syntax error by flake8
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.5k
- Forks
- 190
- Avg merge
- 8m
- Merged PRs (30d)
- 13
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the report with the supplied Python snippet and the stated pyflakes version. Trace how pyflakes handles await expressions inside a non-async function, then add coverage for this case and verify that running the checker reports the syntax error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100