-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
Bug Report
Mypy fails to determine the correct type when iterating over enum.Flag. The example uses reduce from functools. The corresponding typeshed definition for reduce looks correct to me.
Maybe related to #2305
To Reproduce
https://mypy-play.net/?mypy=master&python=3.12&flags=strict&gist=55eabf60ba0d43875271aa8438f04443
Actual Behavior
main.py:6: error: Incompatible return value type (got "object", expected "Flag") [return-value]
main.py:6: error: Unsupported left operand type for | ("object") [operator]
Found 2 errors in 1 file (checked 1 source file)
Your Environment
I've provided the mypy-play.net link but my environment looked like the following:
- Mypy version used: 1.11.2
- Mypy command-line flags: None
- Mypy configuration options from
pyproject.toml:
[tool.mypy]
# Maximum strictness level
strict = true
warn_unused_configs = true
enable_error_code = [
"truthy-bool",
]
enable_incomplete_feature = "NewGenericSyntax"- Python version used: 3.12.6
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong