-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
Description
Bug Report
Starting with mypy 1.14.0, we started getting an error for an enum class that defines a member as an inversion (i.e. ~) of a different member that is declared with enum.auto().
To Reproduce
import enum
class Example(enum.Flag):
USER = enum.auto()
ADMIN = enum.auto()
MACHINE = enum.auto()
HUMAN = ~MACHINEPlayground links:
- https://mypy-play.net/?mypy=1.14.1&python=3.13 (fails)
- https://mypy-play.net/?mypy=1.13.0&python=3.13 (succeeds)
Expected Behavior
The operator should be supported for enum.Flag "auto" members.
Actual Behavior
enum_typing_repro.py:9: error: Unsupported operand type for ~ ("auto") [operator]
Found 1 error in 1 file (checked 1 source file)
FWIW I wonder if this is related to recent changes in typeshed: python/typeshed@3e29e05.
Your Environment
- Mypy version used: 1.14.1
- Mypy command-line flags:
- Mypy configuration options from
mypy.ini(and other config files): - Python version used: 3.13
Reactions are currently unavailable