Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Flag Iterable is inferred as Iterable[builtins.object] instead of the actual class name #14977

Open
sebdivinity opened this issue Mar 29, 2023 · 0 comments
Labels
bug mypy got something wrong topic-enum

Comments

@sebdivinity
Copy link

Bug Report

Mypy infers that iter on Flag return an Iterable of builtins.object instead of the class name.

To Reproduce

from enum import Flag, auto

class Test(Flag):
    A = auto()
    B = auto()
    C = auto()

reveal_type(set(Test))

https://mypy-play.net/?mypy=latest&python=3.11&gist=0533e027a9f70660afa932e59c9d553d

Expected Behavior

main.py:10: note: Revealed type is "builtins.set[Test]"

Actual Behavior

main.py:10: note: Revealed type is "builtins.set[builtins.object]"

Your Environment

  • Mypy version used: 1.1.1
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.11.2
@sebdivinity sebdivinity added the bug mypy got something wrong label Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong topic-enum
Projects
None yet
Development

No branches or pull requests

2 participants