Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLE1142 should flag await in lambda #15783

Open
jakkdl opened this issue Jan 28, 2025 · 3 comments
Open

PLE1142 should flag await in lambda #15783

jakkdl opened this issue Jan 28, 2025 · 3 comments
Labels
bug Something isn't working

Comments

@jakkdl
Copy link

jakkdl commented Jan 28, 2025

Description

"""silence D100"""
async def afoo() -> None:
    """silence D103"""
    return lambda: await afoo()
$ ruff check --select=ALL foo.py
[...]
All checks passed!
$ python foo.py
  File "/tmp/ruff/foo.py", line 6
    return lambda: await afoo()
                   ^^^^^^^^^^^^
SyntaxError: 'await' outside async function
$ ruff --version
ruff 0.9.3
@jakkdl
Copy link
Author

jakkdl commented Jan 28, 2025

Upstream pylint does catch this:

$ pylint --disable=C0104 foo.py
************* Module foo
foo.py:4:19: E1142: 'await' should be used within an async function (await-outside-async)

@AlexWaygood AlexWaygood added the bug Something isn't working label Jan 28, 2025
@InSyncWithFoo
Copy link
Contributor

This seems to be related to #11934.

@jakkdl
Copy link
Author

jakkdl commented Jan 29, 2025

I also reported a similar issue a few months back with #14167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants