Skip to content

[flake8-async] ASYNC100 false positive in async generator expressions #13637

@autinerd

Description

@autinerd

Hi!

ASYNC100 doesn't trigger with this code:

import asyncio

async def long_running_range():
    for i in range(10):
        await asyncio.sleep(2)
        yield i

async def main():
    async with asyncio.timeout(7):
        async for i in long_running_range():
            print(i)

asyncio.run(main())

but it does with this code:

import asyncio

async def long_running_range():
    for i in range(10):
        await asyncio.sleep(2)
        yield i

async def main():
    async with asyncio.timeout(7):
        print({i async for i in long_running_range()})

asyncio.run(main())

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomersruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions