Skip to content

in operator error with Generator #21601

@grayjk

Description

@grayjk

Bug Report
https://mypy-play.net/?mypy=latest&python=3.12&gist=790ec23819f191c250a9574f2b123d8d

To Reproduce

1 in (i for i in (signal.SIGINT,))

Expected Behavior
No error

Actual Behavior
error: Unsupported operand types for in ("int" and "Generator[Signals, None, None]") [operator]

If the generator is changed to a list comprehension, there is no error

Your Environment

  • Mypy version used: 2.1.0 and master branch
  • Python version used: 3.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions