Skip to content

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

Merged
charliermarsh merged 1 commit intomainfrom
charlie/defer
Dec 20, 2023
Merged

Avoid asyncio-dangling-task violations on shadowed bindings#9215
charliermarsh merged 1 commit intomainfrom
charlie/defer

Conversation

@charliermarsh
Copy link
Copy Markdown
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
@charliermarsh charliermarsh deleted the charlie/defer branch December 20, 2023 17:07
@github-actions
Copy link
Copy Markdown
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

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

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