Fails to flag None
passed to constructor of enum.Enum
-based classes
#19094
Labels
None
passed to constructor of enum.Enum
-based classes
#19094
Uh oh!
There was an error while loading. Please reload this page.
Bug Report
Mypy fails to flag
None
passed to constructor ofenum.Enum
-based classes.To Reproduce
Note that changing to
class Foo(int, enum.Enum)
does make mypy flag the error. However, the two aren't equivalent as the latter lets you doFoo.one + 1
while the former requiresFoo.one.value + 1
.Edit: In fact, in both forms it fails to flag invalid arguments such as
Foo(2)
. I do realize this is a slightly different case, which is why I'm focusing onNone
which has different behavior between the two.Expected Behavior
I would expect mypy to flag the last line as an error:
Actual Behavior
Mypy reports no errors.
Your Environment
Tested on
Used
mypy --strict file.py
and justmypy file.py
.Contents of
mypy.ini
(I actually use a pyproject.toml file, but have tested with only this ini-file):The text was updated successfully, but these errors were encountered: