Closed
Description
Using mypy 0.782, errors about incompatible method redefinitions are issued -- but only if multiple inheritance is in play.
How to Reproduce
Run mypy (without any arguments) on this script:
import enum
class C:
pass
class D(C, enum.IntFlag):
pass
Expected behaviour
mypy should print
Success: no issues found in 1 source file
Actual behaviour
mypy prints three error messages:
mypy-error.py:6: error: Definition of "__xor__" in base class "int" is incompatible with definition in base class "Flag"
mypy-error.py:6: error: Definition of "__or__" in base class "int" is incompatible with definition in base class "Flag"
mypy-error.py:6: error: Definition of "__and__" in base class "int" is incompatible with definition in base class "Flag"
Found 3 errors in 1 file (checked 1 source file)
Comments
The error messages go away when
- Not using multiple inheritance, i.e.
class D(enum.IntFlag)
instead ofclass D(C, enum.IntFlag)
. - Or: when using
enum.Flag
instead ofenum.IntFlag