Skip to content

C403 is wrong with async_generator #14644

@dacevedo12

Description

@dacevedo12

Given

set([name for project in projects for name in await get_users(project)])

Ruff outputs

Unnecessary list comprehension (rewrite as a set comprehension) Ruff (C403)

But doing so leads to a runtime error

TypeError: 'async_generator' object is not iterable.

Note that C403 is not triggered by using list() instead of brackets on the comprehension, but it still causes the same runtime error.

Ruff: 0.8.0
Python 3.11

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAsking for support or clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions