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

auto members of IntEnum cannot be annotated as int (false-positive) #1494

Open
cebtenzzre opened this issue Aug 28, 2023 · 0 comments
Open
Labels
bug cat: core core language and typing features

Comments

@cebtenzzre
Copy link

Description

This simple example fails, even though it passes with mypy --strict. I am using pytype 2023.08.22.

Example Code

from enum import IntEnum, auto

class Foo(IntEnum):
    FOO: int = auto()

print(Foo.FOO)
print(isinstance(Foo.FOO, int))

Steps to Reproduce

$ python repr.py
1
True

$ mypy --strict repr.py
Success: no issues found in 1 source file

$ pytype-single repr.py
File "repr.py", line 4, in Foo: Type annotation for FOO does not match type of assignment [annotation-type-mismatch]
  Annotation: int
  Assignment: enum.auto

For more details, see https://google.github.io/pytype/errors.html#annotation-type-mismatch
@rchen152 rchen152 added cat: core core language and typing features bug labels Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cat: core core language and typing features
Projects
None yet
Development

No branches or pull requests

2 participants