Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
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:
importenumclassC:passclassD(C,enum.IntFlag):pass
Expected behaviour
mypy should print
Success: no issues found in 1 source fileActual 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.Flaginstead ofenum.IntFlag