Skip to content
New issue

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

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

Already on GitHub? # to your account

Avoid asyncio-dangling-task violations on shadowed bindings #9215

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

charliermarsh
Copy link
Member

Summary

Ensures that we avoid flagging cases like:

async def f(x: int):
    if x > 0:
        task = asyncio.create_task(make_request())
    else:
        task = asyncio.create_task(make_request())
    await task

Closes #9133.

@charliermarsh charliermarsh added the bug Something isn't working label Dec 20, 2023
@charliermarsh charliermarsh merged commit cbe3bf9 into main Dec 20, 2023
17 checks passed
@charliermarsh charliermarsh deleted the charlie/defer branch December 20, 2023 17:07
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

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

Successfully merging this pull request may close these issues.

Incorrect lint in 0.1.8? RUF006 Store a reference to the return value of asyncio.create_task
1 participant